From: Daniel Kiper Date: Thu, 22 Jun 2023 21:48:52 +0000 (+0200) Subject: lib/relocator: Enforce GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT divisibility by 8 X-Git-Tag: grub-2.12-rc1~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5658f35af97d34af5c8013ce3e206c82e422d67f;p=thirdparty%2Fgrub.git lib/relocator: Enforce GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT divisibility by 8 Most of leftover code blindly assumes GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT divisibility by 8. So, enforce this at compile time. Signed-off-by: Daniel Kiper Reviewed-by: Vladimir Serbinenko --- diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c index 725bca7c3..568fc0b8f 100644 --- a/grub-core/lib/relocator.c +++ b/grub-core/lib/relocator.c @@ -478,6 +478,8 @@ malloc_in_range (struct grub_relocator *rel, #if GRUB_RELOCATOR_HAVE_LEFTOVERS { + COMPILE_TIME_ASSERT (GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT % 8 == 0); + struct grub_relocator_fw_leftover *cur; for (cur = leftovers; cur; cur = cur->next) {