Skip to content

Commit

Permalink
md: remove suspicious size_of()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: NeilBrown <[email protected]>
  • Loading branch information
neilbrown committed Jul 27, 2011
1 parent 768e587 commit a519b26
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a519b26

Please sign in to comment.