Skip to content

Commit

Permalink
dm space map metadata: fix sm_bootstrap_get_nr_blocks()
Browse files Browse the repository at this point in the history
This function isn't right and it causes a static checker warning:

	drivers/md/dm-thin.c:3016 maybe_resize_data_dev()
	error: potentially using uninitialized 'sb_data_size'.

It should set "*count" and return zero on success the same as the
sm_metadata_get_nr_blocks() function does earlier.

Fixes: 3241b1d ('dm: add persistent data library')
Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Joe Thornber <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
  • Loading branch information
Dan Carpenter authored and snitm committed Dec 1, 2014
1 parent 445559c commit c1c6156
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/md/persistent-data/dm-space-map-metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,9 @@ static int sm_bootstrap_get_nr_blocks(struct dm_space_map *sm, dm_block_t *count
{
struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm);

return smm->ll.nr_blocks;
*count = smm->ll.nr_blocks;

return 0;
}

static int sm_bootstrap_get_nr_free(struct dm_space_map *sm, dm_block_t *count)
Expand Down

0 comments on commit c1c6156

Please sign in to comment.