* [PATCH] mvebuimg: replace errant sizeof(4)
@ 2025-11-11 13:32 Ahmad Fatoum
0 siblings, 0 replies; only message in thread
From: Ahmad Fatoum @ 2025-11-11 13:32 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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@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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-11-11 13:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-11 13:32 [PATCH] mvebuimg: replace errant sizeof(4) Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox