ACK: [PATCH 3/3] esrt.c: fix uninitialized use of 'fwversion' warning
Colin Ian King
colin.king at canonical.com
Tue Nov 1 13:15:03 UTC 2016
On 01/11/16 07:07, Erico Nunes wrote:
> This warning shows up with different gcc versions, and may become a
> problem due to the use of -Werror:
>
> uefi/esrt/esrt.c: In function ‘check_entries’:
> uefi/esrt/esrt.c:84: error: ‘fwversion’ may be used uninitialized in this
> function
>
> The warning seems to point to what potentially can be a bug. So, just
> initialize fwversion to a safe value to fix it.
>
> This has been built and tested with gcc 6.2.1, gcc 4.8.5 and gcc 4.4.7.
>
> Signed-off-by: Erico Nunes <ernunes at redhat.com>
> ---
> src/uefi/esrt/esrt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/uefi/esrt/esrt.c b/src/uefi/esrt/esrt.c
> index 69da391..b276dfe 100644
> --- a/src/uefi/esrt/esrt.c
> +++ b/src/uefi/esrt/esrt.c
> @@ -81,7 +81,7 @@ static void check_entries(fwts_framework *fw, bool *passed)
> if (entry && strstr(entry->d_name, "entry")) {
> char path[PATH_MAX];
> char *str;
> - uint32_t fwversion;
> + uint32_t fwversion = 0;
> uint32_t lowest_sp_fwversion;
> bool fwversions_found = true;
>
>
Good catch. I wonder why my static analysis checks missed this one.
Acked-by: Colin Ian King <colin.king at canonical.com>
More information about the fwts-devel
mailing list