[PATCH 3/3] esrt.c: fix uninitialized use of 'fwversion' warning
Erico Nunes
ernunes at redhat.com
Tue Nov 1 13:07:49 UTC 2016
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;
--
2.7.4
More information about the fwts-devel
mailing list