All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: vishal.verma@intel.com, dan.j.williams@intel.com
Cc: linux-nvdimm@lists.01.org
Subject: [ndctl patch] btt_check_bitmap: initialize rc
Date: Fri, 20 Oct 2017 11:58:42 -0400	[thread overview]
Message-ID: <x49k1zperpp.fsf@segfault.boston.devel.redhat.com> (raw)

It may be possible that rc is never set before returning from
the function.  nfree would have to be zero, and the bitmap
would have to be full.  Fix it.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

diff --git a/ndctl/check.c b/ndctl/check.c
index 915bb9d..dafd6a8 100644
--- a/ndctl/check.c
+++ b/ndctl/check.c
@@ -508,7 +508,7 @@ static int btt_check_bitmap(struct arena_info *a)
 {
 	unsigned long *bm;
 	u32 i, btt_mapping;
-	int rc;
+	int rc = BTT_BITMAP_ERROR;
 
 	bm = bitmap_alloc(a->internal_nlba);
 	if (bm == NULL)
@@ -521,7 +521,6 @@ static int btt_check_bitmap(struct arena_info *a)
 			info(a->bttc,
 				"arena %d: internal block %#x is referenced by two map entries\n",
 				a->num, btt_mapping);
-			rc = BTT_BITMAP_ERROR;
 			goto out;
 		}
 		bitmap_set(bm, btt_mapping, 1);
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

             reply	other threads:[~2017-10-20 15:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20 15:58 Jeff Moyer [this message]
2017-10-31 19:32 ` [ndctl patch] btt_check_bitmap: initialize rc Vishal Verma

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=x49k1zperpp.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=vishal.verma@intel.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.