From f0671378426d9768bf20d5e0f8389374dcdc2abf Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Fri, 8 Dec 2006 02:38:54 -0800 Subject: [PATCH] [PATCH] Char: isicom, check kmalloc retval Value returned from kamlloc may be NULL, we should check if ENOMEM occured. Signed-off-by: Jiri Slaby Acked-by: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/isicom.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 91b978445229..783a7ec0a8e6 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c @@ -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); -- 2.39.5