lkml.org 
[lkml]   [2005]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] [SCSI] megaraid: add check for NULL pointer

This patch adds a check for NULL return from kmalloc.

Signed-off-by: Youssef Hmamouche <hyoussef@gmail.com>


--- a/drivers/scsi/megaraid.c 2005-08-03 21:12:43.000000000 -0700
+++ b/drivers/scsi/megaraid.c 2005-08-03 21:14:37.000000000 -0700
@@ -4456,6 +4456,10 @@
memset(scmd, 0, sizeof(Scsi_Cmnd));

sdev = kmalloc(sizeof(struct scsi_device), GFP_KERNEL);
+ if(sdev == NULL) {
+ printk(KERN_WARNING "megaraid: out of RAM.\n");
+ return -ENOMEM;
+ }
memset(sdev, 0, sizeof(struct scsi_device));
scmd->device = sdev;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-08-04 08:16    [W:0.182 / U:0.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site