linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: cmds: resize: fix check_resize_args() return value
@ 2022-10-16  9:29 Sidong Yang
  2022-10-18 14:01 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Sidong Yang @ 2022-10-16  9:29 UTC (permalink / raw)
  To: linux-btrfs, dsterba, Wang Yugui; +Cc: Sidong Yang

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-18 14:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-16  9:29 [PATCH] btrfs-progs: cmds: resize: fix check_resize_args() return value Sidong Yang
2022-10-18 14:01 ` David Sterba

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).