From: NeilBrown Date: Wed, 27 Jul 2011 21:56:24 +0000 (+1000) Subject: md: remove suspicious size_of() X-Git-Tag: Ubuntu-5.10.0-12.13~23452^2~38 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=a519b26dbe6533416d21b552053b0bf687f878d7;p=mirror_ubuntu-hirsute-kernel.git md: remove suspicious size_of() When calling bioset_create we pass the size of the front_pad as sizeof(mddev) which looks suspicious as mddev is a pointer and so it looks like a common mistake where sizeof(*mddev) was intended. The size is actually correct as we want to store a pointer in the front padding of the bios created by the bioset, so make the intent more explicit by using sizeof(mddev_t *) Reported-by: Zdenek Kabelac Signed-off-by: NeilBrown --- diff --git a/drivers/md/md.c b/drivers/md/md.c index 7caa096d02f6..4279b3b58d1a 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -4497,7 +4497,8 @@ int md_run(mddev_t *mddev) } if (mddev->bio_set == NULL) - mddev->bio_set = bioset_create(BIO_POOL_SIZE, sizeof(mddev)); + mddev->bio_set = bioset_create(BIO_POOL_SIZE, + sizeof(mddev_t *)); spin_lock(&pers_lock); pers = find_pers(mddev->level, mddev->clevel);