All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] xfs: donot need to check return value of xlog_kvmalloc()
@ 2022-09-01  2:59 Zhiqiang Liu
  2022-09-01 16:08 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Zhiqiang Liu @ 2022-09-01  2:59 UTC (permalink / raw)
  To: djwong, linux-xfs, linux-kernel; +Cc: linfeilong, wuguanghao, liuzhiqiang26

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.

Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
---
Changelog:
V1 -> V2:
  1.add Reviewed-by: Eric Sandeen <sandeen@redhat.com>
  2.remove santity check of xfs_attri_log_nameval_alloc()
    suggested by Eric Sandeen.

 fs/xfs/xfs_attr_item.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
index 5077a7ad5646..cf5ce607dc05 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;
@@ -441,8 +439,6 @@ xfs_attr_create_intent(
 		attr->xattri_nameval = xfs_attri_log_nameval_alloc(args->name,
 				args->namelen, args->value, args->valuelen);
 	}
-	if (!attr->xattri_nameval)
-		return ERR_PTR(-ENOMEM);

 	attrip = xfs_attri_init(mp, attr->xattri_nameval);
 	xfs_trans_add_item(tp, &attrip->attri_item);
@@ -762,8 +758,6 @@ xlog_recover_attri_commit_pass2(
 	nv = xfs_attri_log_nameval_alloc(attr_name,
 			attri_formatp->alfi_name_len, attr_value,
 			attri_formatp->alfi_value_len);
-	if (!nv)
-		return -ENOMEM;

 	attrip = xfs_attri_init(mp, nv);
 	error = xfs_attri_copy_format(&item->ri_buf[0], &attrip->attri_format);
-- 
2.33.0


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

* Re: [PATCH v2] xfs: donot need to check return value of xlog_kvmalloc()
  2022-09-01  2:59 [PATCH v2] xfs: donot need to check return value of xlog_kvmalloc() Zhiqiang Liu
@ 2022-09-01 16:08 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2022-09-01 16:08 UTC (permalink / raw)
  To: Zhiqiang Liu; +Cc: linux-xfs, linux-kernel, linfeilong, wuguanghao

On Thu, Sep 01, 2022 at 10:59:08AM +0800, 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.
> 
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>

Makes sense...
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
> Changelog:
> V1 -> V2:
>   1.add Reviewed-by: Eric Sandeen <sandeen@redhat.com>
>   2.remove santity check of xfs_attri_log_nameval_alloc()
>     suggested by Eric Sandeen.
> 
>  fs/xfs/xfs_attr_item.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
> index 5077a7ad5646..cf5ce607dc05 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;
> @@ -441,8 +439,6 @@ xfs_attr_create_intent(
>  		attr->xattri_nameval = xfs_attri_log_nameval_alloc(args->name,
>  				args->namelen, args->value, args->valuelen);
>  	}
> -	if (!attr->xattri_nameval)
> -		return ERR_PTR(-ENOMEM);
> 
>  	attrip = xfs_attri_init(mp, attr->xattri_nameval);
>  	xfs_trans_add_item(tp, &attrip->attri_item);
> @@ -762,8 +758,6 @@ xlog_recover_attri_commit_pass2(
>  	nv = xfs_attri_log_nameval_alloc(attr_name,
>  			attri_formatp->alfi_name_len, attr_value,
>  			attri_formatp->alfi_value_len);
> -	if (!nv)
> -		return -ENOMEM;
> 
>  	attrip = xfs_attri_init(mp, nv);
>  	error = xfs_attri_copy_format(&item->ri_buf[0], &attrip->attri_format);
> -- 
> 2.33.0
> 

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

end of thread, other threads:[~2022-09-01 16:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-01  2:59 [PATCH v2] xfs: donot need to check return value of xlog_kvmalloc() Zhiqiang Liu
2022-09-01 16:08 ` Darrick J. Wong

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.