Skip to contentSkip to conversation

Errenous sizeof use in raid1

PATCH New Alexander Nyberg 1 participant 1 message Feb 23, 2005 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Errenous sizeof use in raid1

This isn't a real bug as the smallest slab-size is 32 bytes but please apply for consistency.

Found by the Coverity tool.

===== drivers/md/raid1.c 1.105 vs edited =====

drivers/md/raid1.c +1 -1
@@ -1346,7 +1346,7 @@ static int raid1_reshape(mddev_t *mddev,
 		if (conf->mirrors[d].rdev)
 			return -EBUSY;
 
-	newpoolinfo = kmalloc(sizeof(newpoolinfo), GFP_KERNEL);
+	newpoolinfo = kmalloc(sizeof(*newpoolinfo), GFP_KERNEL);
 	if (!newpoolinfo)
 		return -ENOMEM;
 	newpoolinfo->mddev = mddev;