anitazha / rpms / ndctl

Forked from rpms/ndctl 2 years ago
Clone

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

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