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 master 7/7] bootm: booti: fix false positive uninitialized variable access
Date: Mon,  5 Jun 2023 08:29:39 +0200	[thread overview]
Message-ID: <20230605062939.242063-7-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20230605062939.242063-1-a.fatoum@pengutronix.de>

devicetree is only initialized when oftree is non-NULL and it's only
printed when oftree is non-NULL, so warning about devicetree use in the
printf looks like a false positive. Given that devicetree = *oftree, but
with a different type, we can avoid the warning and reduce devicetree
scope in the progress, by just using *oftree in the printf (%pad takes
a reference to phys_addr_t).

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/booti.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/booti.c b/common/booti.c
index 302d7440abd7..e745ff696376 100644
--- a/common/booti.c
+++ b/common/booti.c
@@ -33,7 +33,7 @@ void *booti_load_image(struct image_data *data, phys_addr_t *oftree)
 {
 	const void *kernel_header =
 			data->os_fit ? data->fit_kernel : data->os_header;
-	unsigned long text_offset, image_size, devicetree, kernel;
+	unsigned long text_offset, image_size, kernel;
 	unsigned long image_end;
 	int ret;
 	void *fdt;
@@ -57,6 +57,8 @@ void *booti_load_image(struct image_data *data, phys_addr_t *oftree)
 	image_end = PAGE_ALIGN(kernel + image_size);
 
 	if (oftree) {
+		unsigned long devicetree;
+
 		if (bootm_has_initrd(data)) {
 			ret = bootm_load_initrd(data, image_end);
 			if (ret)
@@ -84,7 +86,7 @@ void *booti_load_image(struct image_data *data, phys_addr_t *oftree)
 
 	printf("Loaded kernel to 0x%08lx", kernel);
 	if (oftree)
-		printf(", devicetree at 0x%08lx", devicetree);
+		printf(", devicetree at %pa", oftree);
 	printf("\n");
 
 	return (void *)kernel;
-- 
2.39.2




  parent reply	other threads:[~2023-06-05  6:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05  6:29 [PATCH master 1/7] ddr: imx8m: align function definition with prototype Ahmad Fatoum
2023-06-05  6:29 ` [PATCH master 2/7] include: bitmask: avoid -Wint-in-bool-context warning Ahmad Fatoum
2023-06-05  6:29 ` [PATCH master 3/7] net: fec_mpc5200: fix false positive -Wmisleading-indentation Ahmad Fatoum
2023-06-05  6:29 ` [PATCH master 4/7] net: gianfar: fix out of bounds read of local variable Ahmad Fatoum
2023-06-06  9:33   ` Sascha Hauer
2023-06-06 11:31     ` Ahmad Fatoum
2023-06-05  6:29 ` [PATCH master 5/7] MIPS: boot: main_entry: use malloc_end instead of _stext Ahmad Fatoum
2023-06-05  6:29 ` [PATCH master 6/7] MIPS: longsoon: restart: hide access to zero page Ahmad Fatoum
2023-06-05  6:29 ` Ahmad Fatoum [this message]
2023-06-06  9:35 ` [PATCH master 1/7] ddr: imx8m: align function definition with prototype Sascha Hauer

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=20230605062939.242063-7-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