Skip to content

Commit 1b22b4b

Browse files
Colin Ian Kingamalon
authored andcommitted
MIPS: ath25: Check for kzalloc allocation failure
Currently there is no null check on a failed allocation of board_data, and hence a null pointer dereference will occurr. Fix this by checking for the out of memory null pointer. Fixes: a747371 ("MIPS: ath25: add board configuration detection") Signed-off-by: Colin Ian King <colin.king@canonical.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: linux-mips@linux-mips.org Cc: <stable@vger.kernel.org> # 3.19+ Patchwork: https://patchwork.linux-mips.org/patch/18657/ Signed-off-by: James Hogan <jhogan@kernel.org>
1 parent 6ae1756 commit 1b22b4b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/mips/ath25/board.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ int __init ath25_find_config(phys_addr_t base, unsigned long size)
135135
}
136136

137137
board_data = kzalloc(BOARD_CONFIG_BUFSZ, GFP_KERNEL);
138+
if (!board_data)
139+
goto error;
138140
ath25_board.config = (struct ath25_boarddata *)board_data;
139141
memcpy_fromio(board_data, bcfg, 0x100);
140142
if (broken_boarddata) {

0 commit comments

Comments
 (0)