All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: fi resize: fix return value check_resize_args()
@ 2022-08-11 15:22 Sidong Yang
  2022-08-23 20:42 ` David Sterba
  2022-09-12  7:58 ` Wang Yugui
  0 siblings, 2 replies; 4+ messages in thread
From: Sidong Yang @ 2022-08-11 15:22 UTC (permalink / raw)
  To: linux-btrfs; +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.

Signed-off-by: Sidong Yang <realwakka@gmail.com>
---
 cmds/filesystem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmds/filesystem.c b/cmds/filesystem.c
index 7cd08fcd..9eff5680 100644
--- a/cmds/filesystem.c
+++ b/cmds/filesystem.c
@@ -1203,7 +1203,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] 4+ messages in thread

* Re: [PATCH] btrfs-progs: fi resize: fix return value check_resize_args()
  2022-08-11 15:22 [PATCH] btrfs-progs: fi resize: fix return value check_resize_args() Sidong Yang
@ 2022-08-23 20:42 ` David Sterba
  2022-09-12  7:58 ` Wang Yugui
  1 sibling, 0 replies; 4+ messages in thread
From: David Sterba @ 2022-08-23 20:42 UTC (permalink / raw)
  To: Sidong Yang; +Cc: linux-btrfs

On Thu, Aug 11, 2022 at 03:22:39PM +0000, Sidong Yang wrote:
> 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.
> 
> Signed-off-by: Sidong Yang <realwakka@gmail.com>

Added to devel, thanks.

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

* Re: [PATCH] btrfs-progs: fi resize: fix return value check_resize_args()
  2022-08-11 15:22 [PATCH] btrfs-progs: fi resize: fix return value check_resize_args() Sidong Yang
  2022-08-23 20:42 ` David Sterba
@ 2022-09-12  7:58 ` Wang Yugui
  2022-09-12 12:34   ` David Sterba
  1 sibling, 1 reply; 4+ messages in thread
From: Wang Yugui @ 2022-09-12  7:58 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Sidong Yang

Hi,

> 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.
> 
> Signed-off-by: Sidong Yang <realwakka@gmail.com>
> ---
>  cmds/filesystem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cmds/filesystem.c b/cmds/filesystem.c
> index 7cd08fcd..9eff5680 100644
> --- a/cmds/filesystem.c
> +++ b/cmds/filesystem.c
> @@ -1203,7 +1203,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,

This patch will make 'btrfs filesystem resize' always fail, and then break
fstests btrfs/177.

# df -h /mnt/scratch/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb2       1.0G  3.4M  927M   1% /mnt/scratch

# btrfs filesystem resize 3G /mnt/scratch/
Resize device id 1 (/dev/sdb2) from 3.00GiB to 3.00GiB
# echo $?
1

# df -h /mnt/scratch/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb2       1.0G  3.4M  927M   1% /mnt/scratch


'ret' is set to 2 here.
    ret = snprintf(amount_dup, BTRFS_VOL_NAME_MAX, "%s", amount);
    if (strlen(amount) != ret) {
        error("newsize argument is too long");
        ret = 1;
        goto out;
    }

Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2022/09/12



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

* Re: [PATCH] btrfs-progs: fi resize: fix return value check_resize_args()
  2022-09-12  7:58 ` Wang Yugui
@ 2022-09-12 12:34   ` David Sterba
  0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2022-09-12 12:34 UTC (permalink / raw)
  To: Wang Yugui; +Cc: linux-btrfs, Sidong Yang

On Mon, Sep 12, 2022 at 03:58:47PM +0800, Wang Yugui wrote:
> Hi,
> 
> > 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.
> > 
> > Signed-off-by: Sidong Yang <realwakka@gmail.com>
> > ---
> >  cmds/filesystem.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/cmds/filesystem.c b/cmds/filesystem.c
> > index 7cd08fcd..9eff5680 100644
> > --- a/cmds/filesystem.c
> > +++ b/cmds/filesystem.c
> > @@ -1203,7 +1203,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,
> 
> This patch will make 'btrfs filesystem resize' always fail, and then break
> fstests btrfs/177.

I noticed that too when doing the progs release so the patch will be
dropped.

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

end of thread, other threads:[~2022-09-12 12:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11 15:22 [PATCH] btrfs-progs: fi resize: fix return value check_resize_args() Sidong Yang
2022-08-23 20:42 ` David Sterba
2022-09-12  7:58 ` Wang Yugui
2022-09-12 12:34   ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.