Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <xiang@kernel.org>
To: linux-erofs@lists.ozlabs.org
Cc: Gao Xiang <xiang@kernel.org>
Subject: [PATCH] erofs-utils: mkfs: silence false-positive uninitialization warning
Date: Thu, 30 Jul 2026 04:30:58 +0800	[thread overview]
Message-ID: <20260729203058.29830-1-xiang@kernel.org> (raw)

main.c: In function 'mkfs_parse_options_cfg':
main.c:1236:21: warning: 'i' may be used uninitialized in this function [-Wmaybe-uninitialized]
    pclustersize_max = i;
    ~~~~~~~~~~~~~~~~~^~~

Signed-off-by: Gao Xiang <xiang@kernel.org>
---
 mkfs/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mkfs/main.c b/mkfs/main.c
index 33c410d..929ce7c 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1228,7 +1228,7 @@ static int mkfs_parse_options_cfg(struct erofs_importer_params *params,
 #endif
 		case 'C':
 			err = erofs_mkfs_strtol(optarg, &endptr, &i, 0);
-			if (err < 0 || *endptr != '\0' || i <= 0) {
+			if (err || *endptr != '\0' || i <= 0) {
 				erofs_err("invalid physical clustersize %s",
 					  optarg);
 				return -EINVAL;
@@ -1250,7 +1250,7 @@ static int mkfs_parse_options_cfg(struct erofs_importer_params *params,
 				}
 			}
 			err = erofs_mkfs_strtol(optarg, &endptr, &i, 0);
-			if (err < 0 || (*endptr != '\0' && algid != endptr) ||
+			if (err || (*endptr != '\0' && algid != endptr) ||
 			    i <= 0) {
 				erofs_err("invalid metabox option %s", optarg);
 				return -EINVAL;
-- 
2.50.1 (Apple Git-155)



                 reply	other threads:[~2026-07-29 20:31 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=20260729203058.29830-1-xiang@kernel.org \
    --to=xiang@kernel.org \
    --cc=linux-erofs@lists.ozlabs.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