public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix kzalloc in scsi device handler
@ 2010-11-16 13:34 Hillf Danton
  2010-11-16 16:15 ` Moger, Babu
  0 siblings, 1 reply; 8+ messages in thread
From: Hillf Danton @ 2010-11-16 13:34 UTC (permalink / raw)
  To: linux-scsi

They look like typo, since there are four instances of kzalloc almost
typed by the same finger.

The pointer is replaced with a struct, which helps kzalloc return
correct result.

thanks for any comment on the possibility that mem overflow could happen.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/drivers/scsi/device_handler/scsi_dh_alua.c	2010-11-01
19:54:12.000000000 +0800
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c	2010-11-16
20:40:36.000000000 +0800
@@ -759,7 +759,7 @@ static int alua_bus_attach(struct scsi_d
 	unsigned long flags;
 	int err = SCSI_DH_OK;

-	scsi_dh_data = kzalloc(sizeof(struct scsi_device_handler *)
+	scsi_dh_data = kzalloc(sizeof(struct scsi_dh_data)
 			       + sizeof(*h) , GFP_KERNEL);
 	if (!scsi_dh_data) {
 		sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n",
--- a/drivers/scsi/device_handler/scsi_dh_emc.c	2010-11-01
19:54:12.000000000 +0800
+++ b/drivers/scsi/device_handler/scsi_dh_emc.c	2010-11-16
20:40:38.000000000 +0800
@@ -650,7 +650,7 @@ static int clariion_bus_attach(struct sc
 	unsigned long flags;
 	int err;

-	scsi_dh_data = kzalloc(sizeof(struct scsi_device_handler *)
+	scsi_dh_data = kzalloc(sizeof(struct scsi_dh_data)
 			       + sizeof(*h) , GFP_KERNEL);
 	if (!scsi_dh_data) {
 		sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n",
--- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c	2010-11-01
19:54:12.000000000 +0800
+++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c	2010-11-16
20:40:36.000000000 +0800
@@ -338,7 +338,7 @@ static int hp_sw_bus_attach(struct scsi_
 	unsigned long flags;
 	int ret;

-	scsi_dh_data = kzalloc(sizeof(struct scsi_device_handler *)
+	scsi_dh_data = kzalloc(sizeof(struct scsi_dh_data)
 			       + sizeof(struct hp_sw_dh_data) , GFP_KERNEL);
 	if (!scsi_dh_data) {
 		sdev_printk(KERN_ERR, sdev, "%s: Attach Failed\n",
--- a/drivers/scsi/device_handler/scsi_dh_rdac.c	2010-11-01
19:54:12.000000000 +0800
+++ b/drivers/scsi/device_handler/scsi_dh_rdac.c	2010-11-16
20:40:32.000000000 +0800
@@ -800,7 +800,7 @@ static int rdac_bus_attach(struct scsi_d
 	int err;
 	char array_name[ARRAY_LABEL_LEN];

-	scsi_dh_data = kzalloc(sizeof(struct scsi_device_handler *)
+	scsi_dh_data = kzalloc(sizeof(struct scsi_dh_data)
 			       + sizeof(*h) , GFP_KERNEL);
 	if (!scsi_dh_data) {
 		sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n",

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-11-17 13:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-16 13:34 [PATCH] fix kzalloc in scsi device handler Hillf Danton
2010-11-16 16:15 ` Moger, Babu
2010-11-16 17:35   ` Rolf Eike Beer
2010-11-16 18:57     ` Moger, Babu
2010-11-16 19:17       ` Rolf Eike Beer
2010-11-16 19:23         ` Moger, Babu
2010-11-17 10:04     ` Boaz Harrosh
2010-11-17 13:16       ` Hillf Danton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox