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>,
	"Claude Opus 4.6" <noreply@anthropic.com>
Subject: [PATCH master 1/4] FIT: fix potential uninitialized read during fuzzing
Date: Mon, 16 Feb 2026 09:41:36 +0100	[thread overview]
Message-ID: <20260216084142.3546363-1-a.fatoum@pengutronix.de> (raw)

fit_find_last_unit should return -ENOENT when conf_node is NULL
instead of returning 0 without writing *out_unit, as that left
the caller's unit variable uninitialized.

Reported-by: GCC 14.2 -fanalyzer
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/image-fit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/image-fit.c b/common/image-fit.c
index 26bd8e265b25..104a01b73658 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -860,7 +860,7 @@ static int fit_find_last_unit(struct fit_handle *handle,
 	const char *unit = NULL;
 
 	if (!conf_node)
-		return 0;
+		return -ENOENT;
 
 	for_each_child_of_node(conf_node, child)
 		unit = child->name;
-- 
2.47.3




             reply	other threads:[~2026-02-16  8:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-16  8:41 Ahmad Fatoum [this message]
2026-02-16  8:41 ` [PATCH master 2/4] FIT: fix potential underflow of stack array Ahmad Fatoum
2026-02-16  8:41 ` [PATCH master 3/4] of: fdt: fix double free in fdt_ensure_space Ahmad Fatoum
2026-02-16  8:41 ` [PATCH master 4/4] of: overlay: initialize ret to fix garbage return value Ahmad Fatoum

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=20260216084142.3546363-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=noreply@anthropic.com \
    /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