ACK: [PATCH] opal: mtd_info: memset a mtd_info struct to keep static analyzers happy
Alex Hung
alex.hung at canonical.com
Tue Apr 7 18:09:43 UTC 2020
On 2020-04-07 10:52 a.m., 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: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list