From: Sidong Yang <realwakka@gmail.com>
To: linux-btrfs@vger.kernel.org, dsterba@suse.cz,
Wang Yugui <wangyugui@e16-tech.com>
Cc: Sidong Yang <realwakka@gmail.com>
Subject: [PATCH] btrfs-progs: cmds: resize: fix check_resize_args() return value
Date: Sun, 16 Oct 2022 09:29:27 +0000 [thread overview]
Message-ID: <20221016092927.200916-1-realwakka@gmail.com> (raw)
check_resize_args() function checks user argument amount and should
returns it's validity. But now the code returns only zero. This patch
make it correct to return ret. It also needs to set to zero after
checking argument length.
Signed-off-by: Sidong Yang <realwakka@gmail.com>
---
cmds/filesystem.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cmds/filesystem.c b/cmds/filesystem.c
index 7c8323d9..ecd5cd8f 100644
--- a/cmds/filesystem.c
+++ b/cmds/filesystem.c
@@ -1122,6 +1122,7 @@ static int check_resize_args(const char *amount, const char *path) {
ret = 1;
goto out;
}
+ ret = 0;
sizestr = amount_dup;
devstr = strchr(sizestr, ':');
@@ -1208,7 +1209,7 @@ static int check_resize_args(const char *amount, const char *path) {
out:
free(di_args);
- return 0;
+ return ret;
}
static int cmd_filesystem_resize(const struct cmd_struct *cmd,
--
2.34.1
next reply other threads:[~2022-10-16 9:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-16 9:29 Sidong Yang [this message]
2022-10-18 14:01 ` [PATCH] btrfs-progs: cmds: resize: fix check_resize_args() return value David Sterba
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=20221016092927.200916-1-realwakka@gmail.com \
--to=realwakka@gmail.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=wangyugui@e16-tech.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;
as well as URLs for NNTP newsgroup(s).