mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] mvebuimg: replace errant sizeof(4)
Date: Tue, 11 Nov 2025 14:32:45 +0100	[thread overview]
Message-ID: <20251111133245.2711874-1-a.fatoum@pengutronix.de> (raw)

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




                 reply	other threads:[~2025-11-11 13:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251111133245.2711874-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox