From: Jiri Slaby Date: Fri, 8 Dec 2006 10:38:54 +0000 (-0800) Subject: [PATCH] Char: isicom, check kmalloc retval X-Git-Tag: v3.12-rc1~32302^2~191 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f0671378426d9768bf20d5e0f8389374dcdc2abf;p=kernel%2Fkernel-generic.git [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 91b9784..783a7ec 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);