]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
lib/relocator: Enforce GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT divisibility by 8
authorDaniel Kiper <daniel.kiper@oracle.com>
Thu, 22 Jun 2023 21:48:52 +0000 (23:48 +0200)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 22 Jun 2023 22:50:38 +0000 (00:50 +0200)
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 <daniel.kiper@oracle.com>
Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
grub-core/lib/relocator.c

index 725bca7c3c10b54f7fdab11b789c98d0c0cfb3e0..568fc0b8ffb17829e6550e973382c5ed8ecf29b7 100644 (file)
@@ -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)
       {