diff mbox series

[06/29] xfs: remove the name == NULL check from xfs_attr_args_init

Message ID 20200114081051.297488-7-hch@lst.de (mailing list archive)
State Superseded
Headers show
Series [01/29] xfs: remove the ATTR_INCOMPLETE flag | expand

Commit Message

Christoph Hellwig Jan. 14, 2020, 8:10 a.m. UTC
All callers provide a valid name pointer, remove the redundant check.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/libxfs/xfs_attr.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Darrick J. Wong Jan. 21, 2020, 5:57 p.m. UTC | #1
On Tue, Jan 14, 2020 at 09:10:28AM +0100, Christoph Hellwig wrote:
> All callers provide a valid name pointer, remove the redundant check.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Hm.  I wondered if this should become at least an ASSERT(name != NULL)
to catch future users screwing that up, but I think the answer is that
we'll crash soon enough in xfs_da_hashname?

If so,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/libxfs/xfs_attr.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> index 04431ab9f5f5..d5064213577c 100644
> --- a/fs/xfs/libxfs/xfs_attr.c
> +++ b/fs/xfs/libxfs/xfs_attr.c
> @@ -65,10 +65,6 @@ xfs_attr_args_init(
>  	size_t			namelen,
>  	int			flags)
>  {
> -
> -	if (!name)
> -		return -EINVAL;
> -
>  	memset(args, 0, sizeof(*args));
>  	args->geo = dp->i_mount->m_attr_geo;
>  	args->whichfork = XFS_ATTR_FORK;
> -- 
> 2.24.1
>
Christoph Hellwig Jan. 23, 2020, 10:35 p.m. UTC | #2
On Tue, Jan 21, 2020 at 09:57:52AM -0800, Darrick J. Wong wrote:
> On Tue, Jan 14, 2020 at 09:10:28AM +0100, Christoph Hellwig wrote:
> > All callers provide a valid name pointer, remove the redundant check.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Hm.  I wondered if this should become at least an ASSERT(name != NULL)
> to catch future users screwing that up, but I think the answer is that
> we'll crash soon enough in xfs_da_hashname?

Yes, passing a NULL name would blow up instantly and also doesn't really
make sense to start with as you want to set/get something after all..
diff mbox series

Patch

diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index 04431ab9f5f5..d5064213577c 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -65,10 +65,6 @@  xfs_attr_args_init(
 	size_t			namelen,
 	int			flags)
 {
-
-	if (!name)
-		return -EINVAL;
-
 	memset(args, 0, sizeof(*args));
 	args->geo = dp->i_mount->m_attr_geo;
 	args->whichfork = XFS_ATTR_FORK;