* [patch] dm space map metadata: fix sm_bootstrap_get_nr_blocks()
@ 2014-11-29 12:50 Dan Carpenter
2014-12-01 13:56 ` Joe Thornber
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-11-29 12:50 UTC (permalink / raw)
To: Alasdair Kergon, Joe Thornber
Cc: Mike Snitzer, dm-devel, Neil Brown, linux-raid, Jörn Engel,
kernel-janitors
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>
---
Static checker stuff. Not tested.
diff --git a/drivers/md/persistent-data/dm-space-map-metadata.c b/drivers/md/persistent-data/dm-space-map-metadata.c
index 786b689..f4e22bc 100644
--- a/drivers/md/persistent-data/dm-space-map-metadata.c
+++ b/drivers/md/persistent-data/dm-space-map-metadata.c
@@ -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)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] dm space map metadata: fix sm_bootstrap_get_nr_blocks()
2014-11-29 12:50 [patch] dm space map metadata: fix sm_bootstrap_get_nr_blocks() Dan Carpenter
@ 2014-12-01 13:56 ` Joe Thornber
0 siblings, 0 replies; 2+ messages in thread
From: Joe Thornber @ 2014-12-01 13:56 UTC (permalink / raw)
To: Dan Carpenter
Cc: Alasdair Kergon, Mike Snitzer, dm-devel, Neil Brown, linux-raid,
Jörn Engel, kernel-janitors
Ack, thanks.
On Sat, Nov 29, 2014 at 03:50:21PM +0300, Dan Carpenter wrote:
> 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>
> ---
> Static checker stuff. Not tested.
>
> diff --git a/drivers/md/persistent-data/dm-space-map-metadata.c b/drivers/md/persistent-data/dm-space-map-metadata.c
> index 786b689..f4e22bc 100644
> --- a/drivers/md/persistent-data/dm-space-map-metadata.c
> +++ b/drivers/md/persistent-data/dm-space-map-metadata.c
> @@ -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)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-01 13:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-29 12:50 [patch] dm space map metadata: fix sm_bootstrap_get_nr_blocks() Dan Carpenter
2014-12-01 13:56 ` Joe Thornber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).