Skip to contentSkip to conversation

erofs-utils: mkfs: silence false-positive uninitialization warning

PATCH New Gao Xiang 1 participant 1 message Jul 29

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: mkfs: silence false-positive uninitialization warning

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;
    ~~~~~~~~~~~~~~~~~^~~
---
 mkfs/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mkfs/main.c +2 -2
index 33c410d..929ce7c 100644
@@ -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;
Signature · 1 line
2.50.1 (Apple Git-155)