linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: Fix inconsistent IS_ERR and PTR_ERR
@ 2021-02-18  9:28 YueHaibing
  2021-02-19 16:48 ` Samuel Cabrero
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2021-02-18  9:28 UTC (permalink / raw)
  To: sfrench, scabrero, dan.carpenter, aaptel
  Cc: linux-cifs, samba-technical, linux-kernel, 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")
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);
-- 
2.22.0


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

* Re: [PATCH] cifs: Fix inconsistent IS_ERR and PTR_ERR
  2021-02-18  9:28 [PATCH] cifs: Fix inconsistent IS_ERR and PTR_ERR YueHaibing
@ 2021-02-19 16:48 ` Samuel Cabrero
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Cabrero @ 2021-02-19 16:48 UTC (permalink / raw)
  To: YueHaibing, sfrench, dan.carpenter, aaptel
  Cc: linux-cifs, samba-technical, linux-kernel

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



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

end of thread, other threads:[~2021-02-19 16:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-18  9:28 [PATCH] cifs: Fix inconsistent IS_ERR and PTR_ERR YueHaibing
2021-02-19 16:48 ` Samuel Cabrero

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