Blob Blame History Raw
btt_check_bitmap: initialize rc

BZ: 

commit e8700eb1656c84fa29ab0dbfb63db9b0aa0a17a5
Author: Jeff Moyer <jmoyer@redhat.com>
Date:   Fri Oct 20 11:52:21 2017 -0400

    btt_check_bitmap: initialize rc
    
    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);