[PATCH] opal: mem_info: clean up pedantic static analysis warnings

Colin King colin.king at canonical.com
Wed Sep 22 08:54:16 UTC 2021


From: Colin Ian King <colin.king at canonical.com>

Static analysis is warning that namelist may be uninitialized.
Clean this up by setting the pointer to NULL.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/opal/mem_info.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/opal/mem_info.c b/src/opal/mem_info.c
index ac8631d3..03b04762 100644
--- a/src/opal/mem_info.c
+++ b/src/opal/mem_info.c
@@ -137,7 +137,7 @@ static int process_dimm(
 	char *my_dir)
 {
 	int count, i, failures = 0;
-	struct dirent **namelist;
+	struct dirent **namelist = NULL;
 	bool found = false;
 
 	count = scandir(my_dir, &namelist, NULL, alphasort);
@@ -337,7 +337,7 @@ static int process_mba(
 static int get_linux_mem_devices(fwts_framework *fw)
 {
 	int count, i, failures = 0;
-	struct dirent **namelist;
+	struct dirent **namelist = NULL;
 	bool found = false;
 
 	count = scandir(DT_FS_PATH, &namelist, NULL, alphasort);
-- 
2.32.0




More information about the fwts-devel mailing list