All of lore.kernel.org
 help / color / mirror / Atom feed
From: YueHaibing <yuehaibing@huawei.com>
To: <davem@davemloft.net>, <bfields@fieldses.org>,
	<jlayton@kernel.org>, <trond.myklebust@hammerspace.com>,
	<anna.schumaker@netapp.com>
Cc: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
	<linux-nfs@vger.kernel.org>, <jgg@ziepe.ca>,
	<chuck.lever@oracle.com>, <bvanassche@acm.org>,
	YueHaibing <yuehaibing@huawei.com>
Subject: [PATCH net-next] svcrdma: Fix an uninitialized variable false warning
Date: Thu, 20 Dec 2018 17:49:21 +0800	[thread overview]
Message-ID: <20181220094921.3396-1-yuehaibing@huawei.com> (raw)

smatch warning this:
net/sunrpc/xprtrdma/svc_rdma_rw.c:351 svc_rdma_post_chunk_ctxt() error: uninitialized symbol 'bad_wr'
net/sunrpc/xprtrdma/verbs.c:1569 rpcrdma_post_recvs() error: uninitialized symbol 'bad_wr'

'bad_wr' is initialized in ib_post_send. But smatch
doesn't know that and warns this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 net/sunrpc/xprtrdma/svc_rdma_rw.c | 2 +-
 net/sunrpc/xprtrdma/verbs.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/xprtrdma/svc_rdma_rw.c b/net/sunrpc/xprtrdma/svc_rdma_rw.c
index dc19517..0954b25 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_rw.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_rw.c
@@ -308,7 +308,7 @@ static int svc_rdma_post_chunk_ctxt(struct svc_rdma_chunk_ctxt *cc)
 	struct svcxprt_rdma *rdma = cc->cc_rdma;
 	struct svc_xprt *xprt = &rdma->sc_xprt;
 	struct ib_send_wr *first_wr;
-	const struct ib_send_wr *bad_wr;
+	const struct ib_send_wr *bad_wr = NULL;
 	struct list_head *tmp;
 	struct ib_cqe *cqe;
 	int ret;
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 3ddba94..37be70f 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -1518,7 +1518,7 @@ void
 rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp)
 {
 	struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
-	struct ib_recv_wr *wr, *bad_wr;
+	struct ib_recv_wr *wr, *bad_wr = NULL;
 	int needed, count, rc;
 
 	rc = 0;
-- 
2.7.0



             reply	other threads:[~2018-12-20  9:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-20  9:49 YueHaibing [this message]
2018-12-28 15:36 ` [PATCH net-next] svcrdma: Fix an uninitialized variable false warning Chuck Lever
2019-01-03 17:41   ` Bart Van Assche

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=20181220094921.3396-1-yuehaibing@huawei.com \
    --to=yuehaibing@huawei.com \
    --cc=anna.schumaker@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=bvanassche@acm.org \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=jgg@ziepe.ca \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.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.