[PATCH] [SCSI] megaraid: add check for NULL pointer

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

 




This patch adds a check for NULL return from kmalloc.

Signed-off-by: Youssef Hmamouche <hyoussef@xxxxxxxxx>


--- 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;

-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux