ACK: [PATCH] opal: mtd_info: memset a mtd_info struct to keep static analyzers happy

ivanhu ivan.hu at canonical.com
Wed Apr 8 06:42:53 UTC 2020



On 4/8/20 12:52 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> Coverity throws a warning of a potential use of unitialized fields
> in the mtd_info struct, so memset it to zero before calling the ioctl.
> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/opal/mtd_info.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/opal/mtd_info.c b/src/opal/mtd_info.c
> index b9473edf..0af500d2 100644
> --- a/src/opal/mtd_info.c
> +++ b/src/opal/mtd_info.c
> @@ -126,6 +126,7 @@ static int mtd_dev_query(fwts_framework *fw, char *mtd_devnode)
>  		return FWTS_ERROR;
>  	}
>  
> +	(void)memset(&mtd_info, 0, sizeof(mtd_info));
>  	if (ioctl(fd, MEMGETINFO, &mtd_info)) {
>  		(void)close(fd);
>  		fwts_failed(fw, LOG_LEVEL_CRITICAL, "OPAL MTD Info",
> 


Acked-by: Ivan Hu <ivan.hu at canonical.com>



More information about the fwts-devel mailing list