Re: [PATCH 09/12] fs_parser: "string" with missing value is a "flag"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 28, 2019 at 04:59:37PM +0100, Miklos Szeredi wrote:
> There's no such thing as a NULL string value, the fsconfig(2) syscall
> rejects that outright.
> 
> So get rid of that concept from the implementation.
> 
> Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxxxxx>
> ---
>  fs/fs_context.c           | 2 +-
>  fs/fs_parser.c            | 9 ++-------
>  include/linux/fs_parser.h | 1 -
>  3 files changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/fs_context.c b/fs/fs_context.c
> index 66fd7d753e91..7c4216156950 100644
> --- a/fs/fs_context.c
> +++ b/fs/fs_context.c
> @@ -174,7 +174,7 @@ int vfs_parse_fs_string(struct fs_context *fc, const char *key,
>  
>  	struct fs_parameter param = {
>  		.key	= key,
> -		.type	= fs_value_is_string,
> +		.type	= v_size ? fs_value_is_string : fs_value_is_flag,
>  		.size	= v_size,
>  	};

No.  This is simply wrong - as it is, there's no difference between
"foo" and "foo=".  Passing NULL in the latter case is wrong, but
this is not a good fix.

This
        if (v_size > 0) {
                param.string = kmemdup_nul(value, v_size, GFP_KERNEL);
                if (!param.string)
                        return -ENOMEM;
        }
should really be
	if (value) {
                param.string = kmemdup_nul(value, v_size, GFP_KERNEL);
                if (!param.string)
                        return -ENOMEM;
        }
and your chunk should be conditional upon value, not v_size.  The
same problem exists for rbd.c



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux