All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/9pfs: fix return value check in xen_9pfs_front_probe()
@ 2017-05-16 14:22 Wei Yongjun
  2017-05-16 18:35 ` Stefano Stabellini
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2017-05-16 14:22 UTC (permalink / raw)
  To: Eric Van Hensbergen, Ron Minnich, Latchesar Ionkov,
	Stefano Stabellini, Juergen Gross
  Cc: Wei Yongjun, v9fs-developer, netdev

From: Wei Yongjun <weiyongjun1@huawei.com>

In case of error, the function xenbus_read() returns ERR_PTR() and never
returns NULL. The NULL test in the return value check should be replaced
with IS_ERR().

Fixes: 71ebd71921e4 ("xen/9pfs: connect to the backend")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 net/9p/trans_xen.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
index 71e8564..83fe487 100644
--- a/net/9p/trans_xen.c
+++ b/net/9p/trans_xen.c
@@ -454,8 +454,8 @@ static int xen_9pfs_front_probe(struct xenbus_device *dev,
 			goto error_xenbus;
 	}
 	priv->tag = xenbus_read(xbt, dev->nodename, "tag", NULL);
-	if (!priv->tag) {
-		ret = -EINVAL;
+	if (IS_ERR(priv->tag)) {
+		ret = PTR_ERR(priv->tag);
 		goto error_xenbus;
 	}
 	ret = xenbus_transaction_end(xbt, 0);

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

* Re: [PATCH] xen/9pfs: fix return value check in xen_9pfs_front_probe()
  2017-05-16 14:22 [PATCH] xen/9pfs: fix return value check in xen_9pfs_front_probe() Wei Yongjun
@ 2017-05-16 18:35 ` Stefano Stabellini
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Stabellini @ 2017-05-16 18:35 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Eric Van Hensbergen, Ron Minnich, Latchesar Ionkov,
	Stefano Stabellini, Juergen Gross, Wei Yongjun, v9fs-developer,
	netdev

On Tue, 16 May 2017, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> In case of error, the function xenbus_read() returns ERR_PTR() and never
> returns NULL. The NULL test in the return value check should be replaced
> with IS_ERR().
> 
> Fixes: 71ebd71921e4 ("xen/9pfs: connect to the backend")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Thank you!

> ---
>  net/9p/trans_xen.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
> index 71e8564..83fe487 100644
> --- a/net/9p/trans_xen.c
> +++ b/net/9p/trans_xen.c
> @@ -454,8 +454,8 @@ static int xen_9pfs_front_probe(struct xenbus_device *dev,
>  			goto error_xenbus;
>  	}
>  	priv->tag = xenbus_read(xbt, dev->nodename, "tag", NULL);
> -	if (!priv->tag) {
> -		ret = -EINVAL;
> +	if (IS_ERR(priv->tag)) {
> +		ret = PTR_ERR(priv->tag);
>  		goto error_xenbus;
>  	}
>  	ret = xenbus_transaction_end(xbt, 0);
> 

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

end of thread, other threads:[~2017-05-16 18:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-16 14:22 [PATCH] xen/9pfs: fix return value check in xen_9pfs_front_probe() Wei Yongjun
2017-05-16 18:35 ` Stefano Stabellini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.