Linux-NVDIMM Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vishal Verma <vishal.l.verma@intel.com>
To: Jeff Moyer <jmoyer@redhat.com>
Cc: linux-nvdimm@lists.01.org
Subject: Re: [ndctl patch] btt_check_arenas: fix use of uninitialized variable
Date: Tue, 31 Oct 2017 13:20:26 -0600	[thread overview]
Message-ID: <20171031192026.GA5253@omniknight.lm.intel.com> (raw)
In-Reply-To: <x49376ikhuy.fsf@segfault.boston.devel.redhat.com>

On 10/16, Jeff Moyer wrote:
> Coverity complains that rc, passed to btt_xlat_status, may be
> used uninitialized.  In that case, we may also dereference a
> NULL pointer.  Fix it by only calling btt_xlat_status with a
> valid arena.
> 
> Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

Good catch!
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
> 
> diff --git a/ndctl/check.c b/ndctl/check.c
> index 915bb9d..93f95c6 100644
> --- a/ndctl/check.c
> +++ b/ndctl/check.c
> @@ -582,9 +582,10 @@ static int btt_check_arenas(struct btt_chk *bttc)
>  			break;
>  	}
>  
> -	btt_xlat_status(a, rc);
> -	if (rc)
> +	if (a && rc != BTT_OK) {
> +		btt_xlat_status(a, rc);
>  		return -ENXIO;
> +	}
>  	return 0;
>  }
>  
> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

      reply	other threads:[~2017-10-31 19:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 19:33 [ndctl patch] btt_check_arenas: fix use of uninitialized variable Jeff Moyer
2017-10-31 19:20 ` Vishal Verma [this message]

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=20171031192026.GA5253@omniknight.lm.intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-nvdimm@lists.01.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox