summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2010-08-10 18:01:18 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-11 08:59:00 -0700
commit85bc081f44d53e3ac268c59275cc3b9b5afae04a (patch)
tree5f0ff66195736ed6b383828b9e21370e8801a42c
parentd8187b945aa4ed9ea298518e3dac691ea09724e5 (diff)
downloadop-kernel-dev-85bc081f44d53e3ac268c59275cc3b9b5afae04a.zip
op-kernel-dev-85bc081f44d53e3ac268c59275cc3b9b5afae04a.tar.gz
drivers/scsi/aic94xx/aic94xx_init.c: correct the size argument to kmalloc
In each case, the destination of the allocation has type struct **, so the elements of the array should have pointer type, not structure type. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @disable sizeof_type_expr@ type T; T **x; @@ x = <+...sizeof( - T + *x )...+> // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Cc: Rolf Eike Beer <eike-kernel@sf-tec.de> Cc: Joe Perches <joe@perches.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c4
-rw-r--r--drivers/scsi/ch.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 24ac231..3b7e83d 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -688,9 +688,9 @@ static int asd_register_sas_ha(struct asd_ha_struct *asd_ha)
{
int i;
struct asd_sas_phy **sas_phys =
- kmalloc(ASD_MAX_PHYS * sizeof(struct asd_sas_phy), GFP_KERNEL);
+ kcalloc(ASD_MAX_PHYS, sizeof(*sas_phys), GFP_KERNEL);
struct asd_sas_port **sas_ports =
- kmalloc(ASD_MAX_PHYS * sizeof(struct asd_sas_port), GFP_KERNEL);
+ kcalloc(ASD_MAX_PHYS, sizeof(*sas_ports), GFP_KERNEL);
if (!sas_phys || !sas_ports) {
kfree(sas_phys);
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 4799d43..769b35f 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -352,7 +352,7 @@ ch_readconfig(scsi_changer *ch)
}
/* look up the devices of the data transfer elements */
- ch->dt = kmalloc(ch->counts[CHET_DT]*sizeof(struct scsi_device),
+ ch->dt = kcalloc(ch->counts[CHET_DT], sizeof(*ch->dt),
GFP_KERNEL);
if (!ch->dt) {
OpenPOWER on IntegriCloud