anitazha / rpms / ndctl

Forked from rpms/ndctl 2 years ago
Clone

Blame SOURCES/e8700eb-btt_check_bitmap-initialize-rc.patch

bcf6bc
btt_check_bitmap: initialize rc
bcf6bc
bcf6bc
BZ: 
bcf6bc
bcf6bc
commit e8700eb1656c84fa29ab0dbfb63db9b0aa0a17a5
bcf6bc
Author: Jeff Moyer <jmoyer@redhat.com>
bcf6bc
Date:   Fri Oct 20 11:52:21 2017 -0400
bcf6bc
bcf6bc
    btt_check_bitmap: initialize rc
bcf6bc
    
bcf6bc
    It may be possible that rc is never set before returning from
bcf6bc
    the function.  nfree would have to be zero, and the bitmap
bcf6bc
    would have to be full.  Fix it.
bcf6bc
    
bcf6bc
    Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
bcf6bc
bcf6bc
diff --git a/ndctl/check.c b/ndctl/check.c
bcf6bc
index 915bb9d..dafd6a8 100644
bcf6bc
--- a/ndctl/check.c
bcf6bc
+++ b/ndctl/check.c
bcf6bc
@@ -508,7 +508,7 @@ static int btt_check_bitmap(struct arena_info *a)
bcf6bc
 {
bcf6bc
 	unsigned long *bm;
bcf6bc
 	u32 i, btt_mapping;
bcf6bc
-	int rc;
bcf6bc
+	int rc = BTT_BITMAP_ERROR;
bcf6bc
 
bcf6bc
 	bm = bitmap_alloc(a->internal_nlba);
bcf6bc
 	if (bm == NULL)
bcf6bc
@@ -521,7 +521,6 @@ static int btt_check_bitmap(struct arena_info *a)
bcf6bc
 			info(a->bttc,
bcf6bc
 				"arena %d: internal block %#x is referenced by two map entries\n",
bcf6bc
 				a->num, btt_mapping);
bcf6bc
-			rc = BTT_BITMAP_ERROR;
bcf6bc
 			goto out;
bcf6bc
 		}
bcf6bc
 		bitmap_set(bm, btt_mapping, 1);