All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@redhat.com>,
	dm-devel@redhat.com, Joe Thornber <ejt@redhat.com>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: NAK: [PATCH][next] dm space maps: Fix uninitialized variable r2
Date: Fri, 21 May 2021 10:47:51 +0100	[thread overview]
Message-ID: <fe127847-f8ee-20aa-5613-19b8a110c712@canonical.com> (raw)
In-Reply-To: <20210521094031.42356-1-colin.king@canonical.com>

On 21/05/2021 10:40, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> In the case where recursing(mm) is true variable r2 is not
> inintialized and an uninitialized value is being used in the
> call combine_errors later on. Fix this by setting r2 to zero.
> 
> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: def6a7a9a7f0 ("dm space maps: improve performance with inc/dec on ranges of blocks")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/md/persistent-data/dm-space-map-metadata.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/persistent-data/dm-space-map-metadata.c b/drivers/md/persistent-data/dm-space-map-metadata.c
> index 3b70ee861cf5..5be5ef4c831f 100644
> --- a/drivers/md/persistent-data/dm-space-map-metadata.c
> +++ b/drivers/md/persistent-data/dm-space-map-metadata.c
> @@ -432,9 +432,10 @@ static int sm_metadata_dec_blocks(struct dm_space_map *sm, dm_block_t b, dm_bloc
>  	int32_t nr_allocations;
>  	struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm);
>  
> -	if (recursing(smm))
> +	if (recursing(smm)) {
>  		r = add_bop(smm, BOP_DEC, b, e);
> -	else {
> +		r2 = 0;
> +	} else {
>  		in(smm);
>  		r = sm_ll_dec(&smm->ll, b, e, &nr_allocations);
>  		r2 = out(smm);
> 

There is a another occurrence of this, I'll send a V2 shortly

WARNING: multiple messages have this Message-ID (diff)
From: Colin Ian King <colin.king@canonical.com>
To: Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@redhat.com>,
	dm-devel@redhat.com, Joe Thornber <ejt@redhat.com>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [dm-devel] NAK: [PATCH][next] dm space maps: Fix uninitialized variable r2
Date: Fri, 21 May 2021 10:47:51 +0100	[thread overview]
Message-ID: <fe127847-f8ee-20aa-5613-19b8a110c712@canonical.com> (raw)
In-Reply-To: <20210521094031.42356-1-colin.king@canonical.com>

On 21/05/2021 10:40, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> In the case where recursing(mm) is true variable r2 is not
> inintialized and an uninitialized value is being used in the
> call combine_errors later on. Fix this by setting r2 to zero.
> 
> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: def6a7a9a7f0 ("dm space maps: improve performance with inc/dec on ranges of blocks")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/md/persistent-data/dm-space-map-metadata.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/persistent-data/dm-space-map-metadata.c b/drivers/md/persistent-data/dm-space-map-metadata.c
> index 3b70ee861cf5..5be5ef4c831f 100644
> --- a/drivers/md/persistent-data/dm-space-map-metadata.c
> +++ b/drivers/md/persistent-data/dm-space-map-metadata.c
> @@ -432,9 +432,10 @@ static int sm_metadata_dec_blocks(struct dm_space_map *sm, dm_block_t b, dm_bloc
>  	int32_t nr_allocations;
>  	struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm);
>  
> -	if (recursing(smm))
> +	if (recursing(smm)) {
>  		r = add_bop(smm, BOP_DEC, b, e);
> -	else {
> +		r2 = 0;
> +	} else {
>  		in(smm);
>  		r = sm_ll_dec(&smm->ll, b, e, &nr_allocations);
>  		r2 = out(smm);
> 

There is a another occurrence of this, I'll send a V2 shortly

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  reply	other threads:[~2021-05-21  9:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21  9:40 [PATCH][next] dm space maps: Fix uninitialized variable r2 Colin King
2021-05-21  9:40 ` [dm-devel] " Colin King
2021-05-21  9:47 ` Colin Ian King [this message]
2021-05-21  9:47   ` [dm-devel] NAK: " Colin Ian King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fe127847-f8ee-20aa-5613-19b8a110c712@canonical.com \
    --to=colin.king@canonical.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=ejt@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=snitzer@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.