From: Jiri Slaby Date: Fri, 8 Dec 2006 10:38:54 +0000 (-0800) Subject: [PATCH] Char: isicom, check kmalloc retval X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f0671378426d9768bf20d5e0f8389374dcdc2abf;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.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 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);