[PATCH master 1/2] ARM: cpu: start: align uncompressed DTB size to 4 bytes

Ahmad Fatoum a.fatoum at pengutronix.de
Thu May 16 23:22:24 PDT 2024


KASAN reports that decompression exceeds the bounds of the allocation
and my DT size isn't 4-bytes aligned. Align the allocation size to fix
this.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/cpu/start.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index 6d0a7cfc6b04..2adc60fa8831 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -79,7 +79,7 @@ void *barebox_arm_boot_dtb(void)
 
 	pr_debug("%s: using compressed_dtb\n", __func__);
 
-	dtb = malloc(compressed_dtb->datalen_uncompressed);
+	dtb = malloc(ALIGN(compressed_dtb->datalen_uncompressed, 4));
 	if (!dtb)
 		return NULL;
 
-- 
2.39.2




More information about the barebox mailing list