diff mbox series

cifs: Fix inconsistent IS_ERR and PTR_ERR

Message ID 20210218092812.20004-1-yuehaibing@huawei.com (mailing list archive)
State New, archived
Headers show
Series cifs: Fix inconsistent IS_ERR and PTR_ERR | expand

Commit Message

Yue Haibing Feb. 18, 2021, 9:28 a.m. UTC
Fix inconsistent IS_ERR and PTR_ERR in cifs_find_swn_reg(). The proper
pointer to be passed as argument to PTR_ERR() is share_name.

This bug was detected with the help of Coccinelle.

Fixes: bf80e5d4259a ("cifs: Send witness register and unregister commands to userspace daemon")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 fs/cifs/cifs_swn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Samuel Cabrero Feb. 19, 2021, 4:48 p.m. UTC | #1
Thanks Yue, it looks good to me.

Reviewed-by: Samuel Cabrero <scabrero@suse.de>

On Thu, 2021-02-18 at 17:28 +0800, YueHaibing wrote:
> Fix inconsistent IS_ERR and PTR_ERR in cifs_find_swn_reg(). The
> proper
> pointer to be passed as argument to PTR_ERR() is share_name.
> 
> This bug was detected with the help of Coccinelle.
> 
> Fixes: bf80e5d4259a ("cifs: Send witness register and unregister
> commands to userspace daemon")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  fs/cifs/cifs_swn.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/cifs/cifs_swn.c b/fs/cifs/cifs_swn.c
> index d35f599aa00e..f2d730fffccb 100644
> --- a/fs/cifs/cifs_swn.c
> +++ b/fs/cifs/cifs_swn.c
> @@ -272,7 +272,7 @@ static struct cifs_swn_reg
> *cifs_find_swn_reg(struct cifs_tcon *tcon)
>         if (IS_ERR(share_name)) {
>                 int ret;
>  
> -               ret = PTR_ERR(net_name);
> +               ret = PTR_ERR(share_name);
>                 cifs_dbg(VFS, "%s: failed to extract share name from
> target '%s': %d\n",
>                                 __func__, tcon->treeName, ret);
>                 kfree(net_name);
diff mbox series

Patch

diff --git a/fs/cifs/cifs_swn.c b/fs/cifs/cifs_swn.c
index d35f599aa00e..f2d730fffccb 100644
--- a/fs/cifs/cifs_swn.c
+++ b/fs/cifs/cifs_swn.c
@@ -272,7 +272,7 @@  static struct cifs_swn_reg *cifs_find_swn_reg(struct cifs_tcon *tcon)
 	if (IS_ERR(share_name)) {
 		int ret;
 
-		ret = PTR_ERR(net_name);
+		ret = PTR_ERR(share_name);
 		cifs_dbg(VFS, "%s: failed to extract share name from target '%s': %d\n",
 				__func__, tcon->treeName, ret);
 		kfree(net_name);