RE: [patch 24/30] drivers/scsi/megaraid.c: kmalloc + memset conversion to kzalloc

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

 



ACK.

--Sumant
 

-----Original Message-----
From: linux-scsi-owner@xxxxxxxxxxxxxxx
[mailto:linux-scsi-owner@xxxxxxxxxxxxxxx] On Behalf Of
akpm@xxxxxxxxxxxxxxxxxxxx
Sent: Friday, August 10, 2007 2:51 PM
To: James.Bottomley@xxxxxxxxxxxx
Cc: linux-scsi@xxxxxxxxxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx;
m.kozlowski@xxxxxxxxxx
Subject: [patch 24/30] drivers/scsi/megaraid.c: kmalloc + memset
conversion to kzalloc

From: Mariusz Kozlowski <m.kozlowski@xxxxxxxxxx>

This patch does kmalloc + memset conversion to kzalloc and adds missing
check for kzalloc return value.

 drivers/scsi/megaraid.c | 116109 -> 116094 (-15 bytes)
drivers/scsi/megaraid.o | 257872 -> 257772 (-100 bytes)

Signed-off-by: Mariusz Kozlowski <m.kozlowski@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/scsi/megaraid.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff -puN
drivers/scsi/megaraid.c~drivers-scsi-megaraidc-kmalloc-memset-conversion
-to-kzalloc drivers/scsi/megaraid.c
---
a/drivers/scsi/megaraid.c~drivers-scsi-megaraidc-kmalloc-memset-conversi
on-to-kzalloc
+++ a/drivers/scsi/megaraid.c
@@ -4408,8 +4408,10 @@ mega_internal_command(adapter_t *adapter
 	scmd = &adapter->int_scmd;
 	memset(scmd, 0, sizeof(Scsi_Cmnd));
 
-	sdev = kmalloc(sizeof(struct scsi_device), GFP_KERNEL);
-	memset(sdev, 0, sizeof(struct scsi_device));
+	sdev = kzalloc(sizeof(struct scsi_device), GFP_KERNEL);
+	if (!sdev)
+		return -ENOMEM;
+
 	scmd->device = sdev;
 
 	scmd->device->host = adapter->host;
_
-
To unsubscribe from this list: 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
-
To unsubscribe from this list: 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