[PATCH] mvebuimg: replace errant sizeof(4)

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Nov 11 05:32:45 PST 2025


trailer is a 4 byte array and sizeof(4) == sizeof(int) for most
contemporary architectures, so this went unnoticed.

Remove this hidden assumption by using sizeof(trailer).

No functional change for probably all architectures barebox was so far
compiled on..

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

diff --git a/scripts/mvebuimg.c b/scripts/mvebuimg.c
index 8e9b1f911250..b896b5888f78 100644
--- a/scripts/mvebuimg.c
+++ b/scripts/mvebuimg.c
@@ -191,7 +191,7 @@ static int mvebuimg_v1_write_binhdr(int fd, size_t *offset,
 	*offset += ALIGN_SUP(s.st_size, 4);
 	trailer[0] = is_last_header ? 0 : 1;
 
-	summ->method.update(&summ->method, trailer, sizeof(4));
+	summ->method.update(&summ->method, trailer, sizeof(trailer));
 	ret = pwrite(fd, trailer, sizeof(trailer), *offset);
 	if (ret < 0) {
 		pr_err("failed to write trailer of binhdr \"%s\"\n",
-- 
2.47.3




More information about the barebox mailing list