lkml.org 
[lkml]   [2022]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] xfs: donot need to check return value of xlog_kvmalloc()
On 8/22/22 6:46 AM, Zhiqiang Liu wrote:
>
> In xfs_attri_log_nameval_alloc(), xlog_kvmalloc() is called
> to alloc memory, which will always return
> successfully, so we donot need to check return value.
>
> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>

I think this is fine. xlog_kvmalloc loops until success, and its other
caller does not check the return value.

This isn't really strictly a fix (it's harmless) but it "fixes"

Fixes: commit 4183e4f27f402 ("xfs: share xattr name and value buffers when logging xattr updates")

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

That said, I think that xfs_attri_log_nameval_alloc() also cannot fail, so
perhaps its callers don't need checks either?

> ---
> fs/xfs/xfs_attr_item.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
> index 5077a7ad5646..667e151a2bca 100644
> --- a/fs/xfs/xfs_attr_item.c
> +++ b/fs/xfs/xfs_attr_item.c
> @@ -86,8 +86,6 @@ xfs_attri_log_nameval_alloc(
> */
> nv = xlog_kvmalloc(sizeof(struct xfs_attri_log_nameval) +
> name_len + value_len);
> - if (!nv)
> - return nv;
>
> nv->name.i_addr = nv + 1;
> nv->name.i_len = name_len;

\
 
 \ /
  Last update: 2022-08-29 18:07    [W:0.050 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site