From: Jiri Slaby Date: Fri, 8 Dec 2006 10:38:54 +0000 (-0800) Subject: [PATCH] Char: isicom, check kmalloc retval X-Git-Tag: v2.6.20-rc1~34^2~191 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0671378426d9768bf20d5e0f8389374dcdc2abf;p=linux-2.6 [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 --- diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 91b9784452..783a7ec0a8 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);