All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Trond Myklebust <trond.myklebust@primarydata.com>,
	Chuck Lever <chuck.lever@oracle.com>
Cc: Anna Schumaker <anna.schumaker@netapp.com>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Jeff Layton <jlayton@poochiereds.net>,
	linux-nfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] svcrdma: signedness bug in xprt_rdma_bc_send_request()
Date: Tue, 05 Jan 2016 09:50:19 +0000	[thread overview]
Message-ID: <20160105095019.GA23619@mwanda> (raw)

The "len" variable was unsigned so the error handling didn't work.  Also
"len" was a misleading name because it's either a negative error code or
it's zero.  It's never actually a length.  I've renamed it to "ret".

Fixes: eb57be60eca9 ('svcrdma: Add class for RDMA backwards direction transport')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
index 417cec1..deff06a 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
@@ -240,7 +240,7 @@ xprt_rdma_bc_send_request(struct rpc_task *task)
 	struct rpc_rqst *rqst = task->tk_rqstp;
 	struct svc_xprt *sxprt = rqst->rq_xprt->bc_xprt;
 	struct svcxprt_rdma *rdma;
-	u32 len;
+	int ret;
 
 	dprintk("svcrdma: sending bc call with xid: %08x\n",
 		be32_to_cpu(rqst->rq_xid));
@@ -252,15 +252,15 @@ xprt_rdma_bc_send_request(struct rpc_task *task)
 		rpc_wake_up_queued_task(&sxprt->xpt_bc_pending, task);
 	}
 
-	len = -ENOTCONN;
+	ret = -ENOTCONN;
 	rdma = container_of(sxprt, struct svcxprt_rdma, sc_xprt);
 	if (!test_bit(XPT_DEAD, &sxprt->xpt_flags))
-		len = rpcrdma_bc_send_request(rdma, rqst);
+		ret = rpcrdma_bc_send_request(rdma, rqst);
 
 	mutex_unlock(&sxprt->xpt_mutex);
 
-	if (len < 0)
-		return len;
+	if (ret < 0)
+		return ret;
 	return 0;
 }
 

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Trond Myklebust <trond.myklebust@primarydata.com>,
	Chuck Lever <chuck.lever@oracle.com>
Cc: Anna Schumaker <anna.schumaker@netapp.com>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Jeff Layton <jlayton@poochiereds.net>,
	linux-nfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] svcrdma: signedness bug in xprt_rdma_bc_send_request()
Date: Tue, 5 Jan 2016 12:50:19 +0300	[thread overview]
Message-ID: <20160105095019.GA23619@mwanda> (raw)

The "len" variable was unsigned so the error handling didn't work.  Also
"len" was a misleading name because it's either a negative error code or
it's zero.  It's never actually a length.  I've renamed it to "ret".

Fixes: eb57be60eca9 ('svcrdma: Add class for RDMA backwards direction transport')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
index 417cec1..deff06a 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
@@ -240,7 +240,7 @@ xprt_rdma_bc_send_request(struct rpc_task *task)
 	struct rpc_rqst *rqst = task->tk_rqstp;
 	struct svc_xprt *sxprt = rqst->rq_xprt->bc_xprt;
 	struct svcxprt_rdma *rdma;
-	u32 len;
+	int ret;
 
 	dprintk("svcrdma: sending bc call with xid: %08x\n",
 		be32_to_cpu(rqst->rq_xid));
@@ -252,15 +252,15 @@ xprt_rdma_bc_send_request(struct rpc_task *task)
 		rpc_wake_up_queued_task(&sxprt->xpt_bc_pending, task);
 	}
 
-	len = -ENOTCONN;
+	ret = -ENOTCONN;
 	rdma = container_of(sxprt, struct svcxprt_rdma, sc_xprt);
 	if (!test_bit(XPT_DEAD, &sxprt->xpt_flags))
-		len = rpcrdma_bc_send_request(rdma, rqst);
+		ret = rpcrdma_bc_send_request(rdma, rqst);
 
 	mutex_unlock(&sxprt->xpt_mutex);
 
-	if (len < 0)
-		return len;
+	if (ret < 0)
+		return ret;
 	return 0;
 }
 

             reply	other threads:[~2016-01-05  9:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05  9:50 Dan Carpenter [this message]
2016-01-05  9:50 ` [patch] svcrdma: signedness bug in xprt_rdma_bc_send_request() Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160105095019.GA23619@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=anna.schumaker@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@poochiereds.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.