mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][net-next] svcrdma: fix an incorrect check on -E2BIG and -EINVAL
@ 2017-07-13 17:51 Colin King
  2017-07-13 17:53 ` Chuck Lever
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2017-07-13 17:51 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker, J . Bruce Fields, Jeff Layton,
	David S . Miller, Chuck Lever, Sagi Grimberg, linux-nfs, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The current check will always be true and will always jump to
err1, this looks dubious to me. I believe && should be used
instead of ||.

Detected by CoverityScan, CID#1450120 ("Logically Dead Code")

Fixes: 107c1d0a991a ("svcrdma: Avoid Send Queue overflow")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 net/sunrpc/xprtrdma/svc_rdma_sendto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
index 19fd01e4b690..7c3a211e0e9a 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
@@ -684,7 +684,7 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
 	return 0;
 
  err2:
-	if (ret != -E2BIG || ret != -EINVAL)
+	if (ret != -E2BIG && ret != -EINVAL)
 		goto err1;
 
 	ret = svc_rdma_post_recv(rdma, GFP_KERNEL);
-- 
2.11.0

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

* Re: [PATCH][net-next] svcrdma: fix an incorrect check on -E2BIG and -EINVAL
  2017-07-13 17:51 [PATCH][net-next] svcrdma: fix an incorrect check on -E2BIG and -EINVAL Colin King
@ 2017-07-13 17:53 ` Chuck Lever
  2017-07-14  1:39   ` J. Bruce Fields
  0 siblings, 1 reply; 3+ messages in thread
From: Chuck Lever @ 2017-07-13 17:53 UTC (permalink / raw)
  To: Colin King
  Cc: Trond Myklebust, Anna Schumaker, J. Bruce Fields, Jeff Layton,
	David S . Miller, Sagi Grimberg, Linux NFS Mailing List, netdev,
	kernel-janitors, linux-kernel


> On Jul 13, 2017, at 1:51 PM, Colin King <colin.king@canonical.com> wrote:
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> The current check will always be true and will always jump to
> err1, this looks dubious to me. I believe && should be used
> instead of ||.
> 
> Detected by CoverityScan, CID#1450120 ("Logically Dead Code")
> 
> Fixes: 107c1d0a991a ("svcrdma: Avoid Send Queue overflow")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Chuck Lever <chuck.lever@oracle.com>

Dan reported this today, and I have a similar patch in my
"pending for-rc" series. This one works too.


> ---
> net/sunrpc/xprtrdma/svc_rdma_sendto.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> index 19fd01e4b690..7c3a211e0e9a 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> @@ -684,7 +684,7 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
> 	return 0;
> 
>  err2:
> -	if (ret != -E2BIG || ret != -EINVAL)
> +	if (ret != -E2BIG && ret != -EINVAL)
> 		goto err1;
> 
> 	ret = svc_rdma_post_recv(rdma, GFP_KERNEL);
> -- 
> 2.11.0
> 

--
Chuck Lever

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

* Re: [PATCH][net-next] svcrdma: fix an incorrect check on -E2BIG and -EINVAL
  2017-07-13 17:53 ` Chuck Lever
@ 2017-07-14  1:39   ` J. Bruce Fields
  0 siblings, 0 replies; 3+ messages in thread
From: J. Bruce Fields @ 2017-07-14  1:39 UTC (permalink / raw)
  To: Chuck Lever
  Cc: Colin King, Trond Myklebust, Anna Schumaker, Jeff Layton,
	David S . Miller, Sagi Grimberg, Linux NFS Mailing List, netdev,
	kernel-janitors, linux-kernel

On Thu, Jul 13, 2017 at 01:53:10PM -0400, Chuck Lever wrote:
> 
> > On Jul 13, 2017, at 1:51 PM, Colin King <colin.king@canonical.com> wrote:
> > 
> > From: Colin Ian King <colin.king@canonical.com>
> > 
> > The current check will always be true and will always jump to
> > err1, this looks dubious to me. I believe && should be used
> > instead of ||.
> > 
> > Detected by CoverityScan, CID#1450120 ("Logically Dead Code")
> > 
> > Fixes: 107c1d0a991a ("svcrdma: Avoid Send Queue overflow")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> 
> Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
> 
> Dan reported this today, and I have a similar patch in my
> "pending for-rc" series. This one works too.

Applied and merged upstream, thanks.

--b.

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

end of thread, other threads:[~2017-07-14  1:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-13 17:51 [PATCH][net-next] svcrdma: fix an incorrect check on -E2BIG and -EINVAL Colin King
2017-07-13 17:53 ` Chuck Lever
2017-07-14  1:39   ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®