Linux-NVDIMM Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [ndctl patch] btt_check_bitmap: initialize rc
@ 2017-10-20 15:58 Jeff Moyer
  2017-10-31 19:32 ` Vishal Verma
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Moyer @ 2017-10-20 15:58 UTC (permalink / raw)
  To: vishal.verma, dan.j.williams; +Cc: linux-nvdimm

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-31 19:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-20 15:58 [ndctl patch] btt_check_bitmap: initialize rc Jeff Moyer
2017-10-31 19:32 ` Vishal Verma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox