anitazha / rpms / ndctl

Forked from rpms/ndctl 2 years ago
Clone

Blame SOURCES/btt_check_arenas-fix-use-of-uninitialized-variable.patch

4e69d4
commit 775293e93fbc9efafa4672ba8698e427613927f6
4e69d4
Author: Jeff Moyer <jmoyer@redhat.com>
4e69d4
Date:   Mon Oct 16 15:07:38 2017 -0400
4e69d4
4e69d4
    btt_check_arenas: fix use of uninitialized variable
4e69d4
    
4e69d4
    Coverity complains that rc, passed to btt_xlat_status, may be
4e69d4
    used uninitialized.  Further, we could then dereference a NULL
4e69d4
    pointer.  Fix this.
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..93f95c6 100644
4e69d4
--- a/ndctl/check.c
4e69d4
+++ b/ndctl/check.c
4e69d4
@@ -582,9 +582,10 @@ static int btt_check_arenas(struct btt_chk *bttc)
4e69d4
 			break;
4e69d4
 	}
4e69d4
 
4e69d4
-	btt_xlat_status(a, rc);
4e69d4
-	if (rc)
4e69d4
+	if (a && rc != BTT_OK) {
4e69d4
+		btt_xlat_status(a, rc);
4e69d4
 		return -ENXIO;
4e69d4
+	}
4e69d4
 	return 0;
4e69d4
 }
4e69d4