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

Alex Hung alex.hung at canonical.com
Wed Sep 22 19:05:50 UTC 2021


On 2021-09-22 2:54 a.m., Colin King wrote:
> 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);
> 

Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list