cifs: Fix inconsistent IS_ERR and PTR_ERR
authorYueHaibing <yuehaibing@huawei.com>
Thu, 18 Feb 2021 09:28:12 +0000 (17:28 +0800)
committerSteve French <stfrench@microsoft.com>
Sat, 20 Feb 2021 03:29:10 +0000 (21:29 -0600)
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>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/cifs_swn.c

index d35f599..f2d730f 100644 (file)
@@ -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);