linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ocfs2: Fix passing zero to 'PTR_ERR' warning
@ 2019-09-09 10:04 Ding Xiang
  2019-09-10  6:45 ` Joseph Qi
  0 siblings, 1 reply; 2+ messages in thread
From: Ding Xiang @ 2019-09-09 10:04 UTC (permalink / raw)
  To: mark, jlbec, joseph.qi; +Cc: ocfs2-devel, linux-kernel

Fix a static code checker warning:
fs/ocfs2/acl.c:331
	ocfs2_acl_chmod() warn: passing zero to 'PTR_ERR'

Fixes: 5ee0fbd50fd ("ocfs2: revert using ocfs2_acl_chmod to avoid inode cluster lock hang")
Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
---
 fs/ocfs2/acl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index 3e7da39..bb981ec 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -327,8 +327,8 @@ int ocfs2_acl_chmod(struct inode *inode, struct buffer_head *bh)
 	down_read(&OCFS2_I(inode)->ip_xattr_sem);
 	acl = ocfs2_get_acl_nolock(inode, ACL_TYPE_ACCESS, bh);
 	up_read(&OCFS2_I(inode)->ip_xattr_sem);
-	if (IS_ERR(acl) || !acl)
-		return PTR_ERR(acl);
+	if (IS_ERR_OR_NULL(acl))
+		return PTR_ERR_OR_ZERO(acl);
 	ret = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
 	if (ret)
 		return ret;
-- 
1.9.1




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

* Re: [PATCH] ocfs2: Fix passing zero to 'PTR_ERR' warning
  2019-09-09 10:04 [PATCH] ocfs2: Fix passing zero to 'PTR_ERR' warning Ding Xiang
@ 2019-09-10  6:45 ` Joseph Qi
  0 siblings, 0 replies; 2+ messages in thread
From: Joseph Qi @ 2019-09-10  6:45 UTC (permalink / raw)
  To: Ding Xiang, mark, jlbec, Andrew Morton; +Cc: ocfs2-devel, linux-kernel


On 19/9/9 18:04, Ding Xiang wrote:
> Fix a static code checker warning:
> fs/ocfs2/acl.c:331
> 	ocfs2_acl_chmod() warn: passing zero to 'PTR_ERR'
> 
> Fixes: 5ee0fbd50fd ("ocfs2: revert using ocfs2_acl_chmod to avoid inode cluster lock hang")
> Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>

Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
>  fs/ocfs2/acl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
> index 3e7da39..bb981ec 100644
> --- a/fs/ocfs2/acl.c
> +++ b/fs/ocfs2/acl.c
> @@ -327,8 +327,8 @@ int ocfs2_acl_chmod(struct inode *inode, struct buffer_head *bh)
>  	down_read(&OCFS2_I(inode)->ip_xattr_sem);
>  	acl = ocfs2_get_acl_nolock(inode, ACL_TYPE_ACCESS, bh);
>  	up_read(&OCFS2_I(inode)->ip_xattr_sem);
> -	if (IS_ERR(acl) || !acl)
> -		return PTR_ERR(acl);
> +	if (IS_ERR_OR_NULL(acl))
> +		return PTR_ERR_OR_ZERO(acl);
>  	ret = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
>  	if (ret)
>  		return ret;
> 

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

end of thread, other threads:[~2019-09-10  6:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-09 10:04 [PATCH] ocfs2: Fix passing zero to 'PTR_ERR' warning Ding Xiang
2019-09-10  6:45 ` Joseph Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).