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 2/3] partition: fix use of uninitialized variable in error message
Date: Wed, 17 Jul 2024 09:29:12 +0200	[thread overview]
Message-ID: <20240717072913.2830995-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240717072913.2830995-1-a.fatoum@pengutronix.de>

The error message reports the partition number using the variable i, but
that's never initialized, as clang notices. Fix this.

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

diff --git a/common/partitions.c b/common/partitions.c
index 0b10377e7327..d46ed4080597 100644
--- a/common/partitions.c
+++ b/common/partitions.c
@@ -241,7 +241,7 @@ void partition_desc_init(struct partition_desc *pd, struct block_device *blk)
  */
 int parse_partition_table(struct block_device *blk)
 {
-	int i;
+	int i = 0;
 	int rc = 0;
 	struct partition *part;
 	struct partition_desc *pdesc;
@@ -259,6 +259,8 @@ int parse_partition_table(struct block_device *blk)
 				i, blk->cdev.name, rc);
 		if (rc != -ENODEV)
 			rc = 0;
+
+		i++;
 	}
 
 	partition_table_free(pdesc);
-- 
2.39.2




  reply	other threads:[~2024-07-17  7:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17  7:29 [PATCH master 1/3] environment: don't leak environment path buffer Ahmad Fatoum
2024-07-17  7:29 ` Ahmad Fatoum [this message]
2024-07-17  7:29 ` [PATCH master 3/3] of: fdt: harden against corrupted reserve map entries Ahmad Fatoum
2024-07-19  6:45 ` [PATCH master 1/3] environment: don't leak environment path buffer 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=20240717072913.2830995-2-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