Skip to content

Commit

Permalink
[PATCH] Char: isicom, check kmalloc retval
Browse files Browse the repository at this point in the history
Value returned from kamlloc may be NULL, we should check if ENOMEM occured.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Jiri Slaby authored and Linus Torvalds committed Dec 8, 2006
1 parent 78028da commit f067137
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/char/isicom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1709,6 +1709,11 @@ static int __devinit load_firmware(struct pci_dev *pdev,
}

data = kmalloc(word_count * 2, GFP_KERNEL);
if (data == NULL) {
dev_err(&pdev->dev, "Card%d, firmware upload "
"failed, not enough memory\n", index + 1);
goto errrelfw;
}
inw(base);
insw(base, data, word_count);
InterruptTheCard(base);
Expand Down

0 comments on commit f067137

Please sign in to comment.