dm space map metadata: fix sm_bootstrap_get_nr_blocks()
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 29 Nov 2014 12:50:21 +0000 (15:50 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2015 17:58:15 +0000 (09:58 -0800)
commit c1c6156fe4d4577444b769d7edd5dd503e57bbc9 upstream.

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: 3241b1d3e0aa ('dm: add persistent data library')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/persistent-data/dm-space-map-metadata.c

index afb419e514bf53f2ed1f1173c31471c5fac3e1f5..056d09c33af14a104c8f16b95cc7c06e251f4bb0 100644 (file)
@@ -493,7 +493,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)