lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <640C401CAB291F86+ffb78b4f37e75faf2b4730e625b8d72d15be782a.camel@uniontech.com>
Date: Fri, 17 Jan 2025 17:50:47 +0800
From: Chen Linxuan <chenlinxuan@...ontech.com>
To: Gao Xiang <hsiangkao@...ux.alibaba.com>, Gao Xiang <xiang@...nel.org>, 
 Chao Yu <chao@...nel.org>, Yue Hu <zbestahu@...il.com>, Jeffle Xu
 <jefflexu@...ux.alibaba.com>,  Sandeep Dhavale <dhavale@...gle.com>
Cc: linux-erofs@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] erofs: add error log in erofs_fc_parse_param

On Fri, 2025-01-17 at 17:28 +0800, Gao Xiang wrote:
> Hi Linxuan,
> 
> On 2025/1/17 16:52, Chen Linxuan wrote:
> > While reading erofs code, I notice that `erofs_fc_parse_param` will
> > return -ENOPARAM, which means that erofs do not support this option,
> > without report anything when `fs_parse` return an unknown `opt`.
> > 
> > But if an option is unknown to erofs, I mean that option not in
> > `erofs_fs_parameters` at all, `fs_parse` will return -ENOPARAM,
> > which means that `erofs_fs_parameters` should has returned earlier.
> > 
> > Entering `default` means `fs_parse` return something we unexpected.
> > I am not sure about it but I think we should return -EINVAL here,
> > just like `xfs_fs_parse_param`.
> > 
> > Signed-off-by: Chen Linxuan <chenlinxuan@...ontech.com>
> 
> I think the default branch is actually deadcode here, see
> erofs_fc_parse_param() -> fs_parse() -> fs_lookup_key() -> -ENOPARAM
> 
> then vfs_parse_fs_param() will show "Unknown parameter".
> 
> Maybe we could just kill `default:` branch...

ext4 do not have a `default:` branch, but xfs return -EINVAL.

I think `default:` branch can report error when `fs_parse` or
`erofs_fs_parameters` goes wrong.

But I am OK to kill `default:` branch.

> 
> Thanks,
> Gao Xiang
> 
> 
> > ---
> >   fs/erofs/super.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> > index 1fc5623c3a4d..67fc4c1deb98 100644
> > --- a/fs/erofs/super.c
> > +++ b/fs/erofs/super.c
> > @@ -509,7 +509,8 @@ static int erofs_fc_parse_param(struct fs_context *fc,
> >   #endif
> >   		break;
> >   	default:
> > -		return -ENOPARAM;
> > +		errorfc(fc, "%s option not supported", param->key);
> > +		return -EINVAL;
> >   	}
> >   	return 0;
> >   }
> 
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ