]> git.proxmox.com Git - grub2.git/commitdiff
mkimage: Pad DTBs to target-specific pointer size
authorMatthew Daley <mattd@bugfuzz.com>
Tue, 6 Nov 2018 22:44:08 +0000 (11:44 +1300)
committerDaniel Kiper <daniel.kiper@oracle.com>
Fri, 16 Nov 2018 13:39:53 +0000 (14:39 +0100)
Device tree (DTB) lengths are being padded to a multiple of 4 bytes
rather than the target-specific pointer size. This causes objects
following OBJ_TYPE_DTB objects to be incorrectly parsed during GRUB
execution on arm64.

Fix by using ALIGN_ADDR(), not ALIGN_UP().

Signed-by-off: Matthew Daley <mattd@bugfuzz.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
util/mkimage.c

index e22d82afa61a6aa4209c7ab6d2aa5b58f95e1bfe..b2f43fea625c1ea0c0e87996c3fc8609421479e2 100644 (file)
@@ -829,7 +829,7 @@ grub_install_generate_image (const char *dir, const char *prefix,
 
   if (dtb_path)
     {
-      dtb_size = ALIGN_UP(grub_util_get_image_size (dtb_path), 4);
+      dtb_size = ALIGN_ADDR(grub_util_get_image_size (dtb_path));
       total_module_size += dtb_size + sizeof (struct grub_module_header);
     }