[PATCH 7/7] Char: isicom, check kmalloc retval

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



isicom, check kmalloc retval

Value returned from kamlloc may be NULL, we should check if ENOMEM occured.

Signed-off-by: Jiri Slaby <[email protected]>

---
commit a026bdacd388dd774b6e6bd50dcb12adb10115f1
tree f729251fccf62c68dfc4e126574f2e1ee898a35a
parent b298d99f4a779fb54b0035f0f870d5247b13b269
author Jiri Slaby <[email protected]> Thu, 19 Oct 2006 19:47:29 +0200
committer Jiri Slaby <[email protected]> Thu, 19 Oct 2006 19:47:29 +0200

 drivers/char/isicom.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 2f5be09..a3d59a6 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -1708,6 +1708,11 @@ static int __devinit load_firmware(struc
 		}
 
 		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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux