From patchwork Fri Feb 11 22:17:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: babu moger X-Patchwork-Id: 550971 Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1BMIsMZ017198 for ; Fri, 11 Feb 2011 22:19:15 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1BMGs9r001233; Fri, 11 Feb 2011 17:16:54 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1BMGq65018298 for ; Fri, 11 Feb 2011 17:16:52 -0500 Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.18]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p1BMGlso007089 for ; Fri, 11 Feb 2011 17:16:47 -0500 Received: from na3sys009aog108.obsmtp.com (na3sys009aog108.obsmtp.com [74.125.149.199]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1BMGd95014775 for ; Fri, 11 Feb 2011 17:16:39 -0500 Received: from source ([192.19.220.66]) (using TLSv1) by na3sys009aob108.postini.com ([74.125.148.12]) with SMTP ID DSNKTVW1RpCgt3WFRnbl65TFF3jgft5dzI5/@postini.com; Fri, 11 Feb 2011 14:16:39 PST Received: from coshub01.lsi.com (135.142.2.64) by COSEDGE01.lsi.com (192.19.220.66) with Microsoft SMTP Server (TLS) id 8.3.137.0; Fri, 11 Feb 2011 15:17:05 -0700 Received: from cosmail01.lsi.com ([172.21.36.24]) by coshub01.lsi.com ([135.142.2.64]) with mapi; Fri, 11 Feb 2011 15:17:32 -0700 From: "Moger, Babu" To: "linux-scsi@vger.kernel.org" , "dm-devel@redhat.com" Date: Fri, 11 Feb 2011 15:17:33 -0700 Thread-Topic: [PATCH v2] [SCSI] fix kzalloc in scsi device handler Thread-Index: AcvKOXrnl11GbDcnQDKav50Wapubeg== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.18 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id p1BMGq65018298 X-loop: dm-devel@redhat.com Cc: "dhillf@gmail.com" Subject: [dm-devel] [PATCH v2] [SCSI] fix kzalloc in scsi device handler X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 11 Feb 2011 22:19:21 +0000 (UTC) diff -uprN -X linux-2.6.38-rc4/Documentation/dontdiff linux-2.6.38-rc4/drivers/scsi/device_handler/scsi_dh_alua.c linux-2.6.38-rc4-patched//drivers/scsi/device_handler/scsi_dh_alua.c --- linux-2.6.38-rc4/drivers/scsi/device_handler/scsi_dh_alua.c 2011-02-07 18:03:55.000000000 -0600 +++ linux-2.6.38-rc4-patched//drivers/scsi/device_handler/scsi_dh_alua.c 2011-02-11 15:29:31.000000000 -0600 @@ -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(*scsi_dh_data) + sizeof(*h) , GFP_KERNEL); if (!scsi_dh_data) { sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n", diff -uprN -X linux-2.6.38-rc4/Documentation/dontdiff linux-2.6.38-rc4/drivers/scsi/device_handler/scsi_dh_emc.c linux-2.6.38-rc4-patched//drivers/scsi/device_handler/scsi_dh_emc.c --- linux-2.6.38-rc4/drivers/scsi/device_handler/scsi_dh_emc.c 2011-02-07 18:03:55.000000000 -0600 +++ linux-2.6.38-rc4-patched//drivers/scsi/device_handler/scsi_dh_emc.c 2011-02-11 15:29:50.000000000 -0600 @@ -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(*scsi_dh_data) + sizeof(*h) , GFP_KERNEL); if (!scsi_dh_data) { sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n", diff -uprN -X linux-2.6.38-rc4/Documentation/dontdiff linux-2.6.38-rc4/drivers/scsi/device_handler/scsi_dh_hp_sw.c linux-2.6.38-rc4-patched//drivers/scsi/device_handler/scsi_dh_hp_sw.c --- linux-2.6.38-rc4/drivers/scsi/device_handler/scsi_dh_hp_sw.c 2011-02-07 18:03:55.000000000 -0600 +++ linux-2.6.38-rc4-patched//drivers/scsi/device_handler/scsi_dh_hp_sw.c 2011-02-11 15:30:45.000000000 -0600 @@ -338,8 +338,8 @@ static int hp_sw_bus_attach(struct scsi_ unsigned long flags; int ret; - scsi_dh_data = kzalloc(sizeof(struct scsi_device_handler *) - + sizeof(struct hp_sw_dh_data) , GFP_KERNEL); + scsi_dh_data = kzalloc(sizeof(*scsi_dh_data) + + sizeof(*h) , GFP_KERNEL); if (!scsi_dh_data) { sdev_printk(KERN_ERR, sdev, "%s: Attach Failed\n", HP_SW_NAME); diff -uprN -X linux-2.6.38-rc4/Documentation/dontdiff linux-2.6.38-rc4/drivers/scsi/device_handler/scsi_dh_rdac.c linux-2.6.38-rc4-patched//drivers/scsi/device_handler/scsi_dh_rdac.c --- linux-2.6.38-rc4/drivers/scsi/device_handler/scsi_dh_rdac.c 2011-02-07 18:03:55.000000000 -0600 +++ linux-2.6.38-rc4-patched//drivers/scsi/device_handler/scsi_dh_rdac.c 2011-02-11 15:29:18.000000000 -0600 @@ -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(*scsi_dh_data) + sizeof(*h) , GFP_KERNEL); if (!scsi_dh_data) { sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n",