Skip to contentSkip to conversation

cifs: Fix inconsistent IS_ERR and PTR_ERR

PATCH In review YueHaibing 2 participants 2 messages Feb 18, 2021 – Feb 19, 2021

Subsystems (2)
lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 cifs: Fix inconsistent IS_ERR and PTR_ERR

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")
---
 fs/cifs/cifs_swn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/cifs_swn.c +1 -1
index d35f599aa00e..f2d730fffccb 100644
@@ -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);
Signature · 1 line
2.22.0
Reviewed-by on v1 1/1
#1 lore raw

Thanks Yue, it looks good to me.

Quoted 28 lines · YueHaibing

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")

---
 fs/cifs/cifs_swn.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/cifs_swn.c +0 -0
index d35f599aa00e..f2d730fffccb 100644
@@ -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);