diff --git a/tboot-fix-alloc-size-warning.patch b/tboot-fix-alloc-size-warning.patch new file mode 100644 index 0000000..d36c731 --- /dev/null +++ b/tboot-fix-alloc-size-warning.patch @@ -0,0 +1,13 @@ +Index: tboot-1.11.4/lcptools-v2/pconf_legacy.c +=================================================================== +--- tboot-1.11.4.orig/lcptools-v2/pconf_legacy.c ++++ tboot-1.11.4/lcptools-v2/pconf_legacy.c +@@ -324,7 +324,7 @@ static lcp_policy_element_t *create(void + ERROR("Error: no pcrs were selected.\n"); + return NULL; + } +- digest = malloc(SHA1_DIGEST_SIZE); ++ digest = malloc(sizeof(*digest)); + if (digest == NULL) { + ERROR("Error: failed to allocate memory for digest buffer.\n"); + return NULL; diff --git a/tboot.changes b/tboot.changes index 37e23f6..4b920d4 100644 --- a/tboot.changes +++ b/tboot.changes @@ -1,3 +1,19 @@ +------------------------------------------------------------------- +Wed Aug 28 08:27:34 UTC 2024 - Matthias Gerstner + +- add tboot-fix-alloc-size-warning.patch: newest GCC spits out this error: + + ``` + pconf_legacy.c: In function ‘create’: + pconf_legacy.c:327:16: error: allocation of insufficient size ‘20’ for type ‘tb_hash_t’ with size ‘64’ [-Werror=alloc-size] + 327 | digest = malloc(SHA1_DIGEST_SIZE); + | ^ + ``` + + There's a union data type behind this. It's not an actual error. To get rid + of the warning, the patch allocates the full union size, thereby wasting a + bit of memory. + ------------------------------------------------------------------- Tue Jun 25 07:34:57 UTC 2024 - Matthias Gerstner diff --git a/tboot.spec b/tboot.spec index e4f176b..4a30ddb 100644 --- a/tboot.spec +++ b/tboot.spec @@ -31,6 +31,7 @@ Patch4: tboot-grub2-fix-xen-submenu-name.patch Patch7: tboot-distributor.patch Patch8: tboot-grub2-refuse-secure-boot.patch Patch9: tboot-bsc#1207833-copy-mbi.patch +Patch10: tboot-fix-alloc-size-warning.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build ExclusiveArch: %{ix86} x86_64 BuildRequires: openssl-devel