[PATCH] uefi: clean up a cppcheck style warning

Colin King colin.king at canonical.com
Thu Jan 14 15:05:56 UTC 2021


From: Colin Ian King <colin.king at canonical.com>

Cppcheck is complaining because the structure capsuleheader
is being referenced but it is never used. It is probably a
good idea to zero this structure to silence this warning and
to ensure the referenced data does not contain garbage.

Cleans cppcheck warning:
src/uefi/uefirtmisc/uefirtmisc.c:102:21: style: Unused
variable: capsuleheader [unusedVariable]
 EFI_CAPSULE_HEADER capsuleheader

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/uefi/uefirtmisc/uefirtmisc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/uefi/uefirtmisc/uefirtmisc.c b/src/uefi/uefirtmisc/uefirtmisc.c
index 690e587c..9dbe4944 100644
--- a/src/uefi/uefirtmisc/uefirtmisc.c
+++ b/src/uefi/uefirtmisc/uefirtmisc.c
@@ -103,6 +103,8 @@ static int querycapsulecapabilities_test(fwts_framework *fw, uint32_t multitestt
 	uint64_t maxcapsulesize;
 	uint64_t capsulecount;
 
+	memset(&capsuleheader, 0, sizeof(capsuleheader));
+
 	pcapsuleheaderarray[0] = &capsuleheader;
 	pcapsuleheaderarray[1] = NULL;
 	pcapsuleheaderarray[0]->CapsuleGuid = gEfiCapsuleHeaderGuid;
-- 
2.29.2




More information about the fwts-devel mailing list