Skip to contentSkip to conversation

drivers/scsi/megaraid.c: kmalloc + memset conversion to kzalloc

PATCH NAK [email protected] 2 participants 2 messages Aug 10, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 24/30 drivers/scsi/megaraid.c: kmalloc + memset conversion to kzalloc

From: Mariusz Kozlowski <[email protected]>

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)

---

 drivers/scsi/megaraid.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/megaraid.c renamed from drivers/scsi/megaraid.c~drivers-scsi-megaraidc-kmalloc-memset-conversion-to-kzalloc +4 -2
diff -puN drivers/scsi/megaraid.c~drivers-scsi-megaraidc-kmalloc-memset-conversion-to-kzalloc 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;

_

#1 lore raw

ACK.

--Sumant

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
Sent: Friday, August 10, 2007 2:51 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: [patch 24/30] drivers/scsi/megaraid.c: kmalloc + memset conversion to kzalloc

From: Mariusz Kozlowski <[email protected]>

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)

---

 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html