Skip to contentSkip to conversation

mkimage: pad DTBs to target-specific pointer size

PATCH In review Matthew Daley 2 participants 2 messages Nov 6, 2018 – Nov 14, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mkimage: pad DTBs to target-specific pointer size

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 <[email protected]>

---
 util/mkimage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
util/mkimage.c +1 -1
index e22d82afa..b2f43fea6 100644
@@ -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);
     }
 
Signature · 1 line
2.11.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Matthew Daley

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 <[email protected]>

Daniel