Hi all,
After merging the rdma tree, today's linux-next build (powerpc
ppc64_defconfig) produced this warning:
net/sunrpc/xprtrdma/svc_rdma_rw.c: In function 'svc_rdma_post_chunk_ctxt':
net/sunrpc/xprtrdma/svc_rdma_rw.c:350:5: warning: 'bad_wr' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (bad_wr != first_wr)
^
Introduced by commit
ed288d74a9e5 ("net/xprtrdma: Simplify ib_post_(send|recv|srq_recv)() calls")
This is an actual problem.
--
Cheers,
Stephen Rothwell
On Thu, Jul 26, 2018 at 10:55:53AM +1000, Stephen Rothwell wrote:
> Hi all,
>
> After merging the rdma tree, today's linux-next build (powerpc
> ppc64_defconfig) produced this warning:
>
> net/sunrpc/xprtrdma/svc_rdma_rw.c: In function 'svc_rdma_post_chunk_ctxt':
> net/sunrpc/xprtrdma/svc_rdma_rw.c:350:5: warning: 'bad_wr' may be used uninitialized in this function [-Wmaybe-uninitialized]
> if (bad_wr != first_wr)
> ^
Huh. I'm quite surprised 0-day build service didn't warn on this.
> Introduced by commit
>
> ed288d74a9e5 ("net/xprtrdma: Simplify ib_post_(send|recv|srq_recv)() calls")
>
> This is an actual problem.
Yes, for sure. Bart?
Thanks,
Jason
On Wed, 2018-07-25 at 21:05 -0600, Jason Gunthorpe wrote:
+AD4- On Thu, Jul 26, 2018 at 10:55:53AM +-1000, Stephen Rothwell wrote:
+AD4- +AD4- Hi all,
+AD4- +AD4-
+AD4- +AD4- After merging the rdma tree, today's linux-next build (powerpc
+AD4- +AD4- ppc64+AF8-defconfig) produced this warning:
+AD4- +AD4-
+AD4- +AD4- net/sunrpc/xprtrdma/svc+AF8-rdma+AF8-rw.c: In function 'svc+AF8-rdma+AF8-post+AF8-chunk+AF8-ctxt':
+AD4- +AD4- net/sunrpc/xprtrdma/svc+AF8-rdma+AF8-rw.c:350:5: warning: 'bad+AF8-wr' may be used uninitialized in this function +AFs--Wmaybe-uninitialized+AF0-
+AD4- +AD4- if (bad+AF8-wr +ACEAPQ- first+AF8-wr)
+AD4- +AD4- +AF4-
+AD4-
+AD4- Huh. I'm quite surprised 0-day build service didn't warn on this.
+AD4-
+AD4- +AD4- Introduced by commit
+AD4- +AD4-
+AD4- +AD4- ed288d74a9e5 (+ACI-net/xprtrdma: Simplify ib+AF8-post+AF8-(send+AHw-recv+AHw-srq+AF8-recv)() calls+ACI-)
+AD4- +AD4-
+AD4- +AD4- This is an actual problem.
+AD4-
+AD4- Yes, for sure. Bart?
Thanks Stephen for having reported this. I propose to revert the changes in
net/sunrpc/xprtrdma/svc+AF8-rdma+AF8-rw.c. Jason, do you want me to submit the below
as a formal patch?
Thanks,
Bart.
diff --git a/net/sunrpc/xprtrdma/svc+AF8-rdma+AF8-rw.c b/net/sunrpc/xprtrdma/svc+AF8-rdma+AF8-rw.c
index 80975427f523..ce3ea8419704 100644
--- a/net/sunrpc/xprtrdma/svc+AF8-rdma+AF8-rw.c
+-+-+- b/net/sunrpc/xprtrdma/svc+AF8-rdma+AF8-rw.c
+AEAAQA- -329,7 +-329,7 +AEAAQA- static int svc+AF8-rdma+AF8-post+AF8-chunk+AF8-ctxt(struct svc+AF8-rdma+AF8-chunk+AF8-ctxt +ACo-cc)
do +AHs-
if (atomic+AF8-sub+AF8-return(cc-+AD4-cc+AF8-sqecount,
+ACY-rdma-+AD4-sc+AF8-sq+AF8-avail) +AD4- 0) +AHs-
- ret +AD0- ib+AF8-post+AF8-send(rdma-+AD4-sc+AF8-qp, first+AF8-wr, NULL)+ADs-
+- ret +AD0- ib+AF8-post+AF8-send(rdma-+AD4-sc+AF8-qp, first+AF8-wr, +ACY-bad+AF8-wr)+ADs-
trace+AF8-svcrdma+AF8-post+AF8-rw(+ACY-cc-+AD4-cc+AF8-cqe,
cc-+AD4-cc+AF8-sqecount, ret)+ADs-
if (ret)
On Thu, Jul 26, 2018 at 05:10:13AM +0000, Bart Van Assche wrote:
> On Wed, 2018-07-25 at 21:05 -0600, Jason Gunthorpe wrote:
> > On Thu, Jul 26, 2018 at 10:55:53AM +1000, Stephen Rothwell wrote:
> > > Hi all,
> > >
> > > After merging the rdma tree, today's linux-next build (powerpc
> > > ppc64_defconfig) produced this warning:
> > >
> > > net/sunrpc/xprtrdma/svc_rdma_rw.c: In function 'svc_rdma_post_chunk_ctxt':
> > > net/sunrpc/xprtrdma/svc_rdma_rw.c:350:5: warning: 'bad_wr' may be used uninitialized in this function [-Wmaybe-uninitialized]
> > > if (bad_wr != first_wr)
> > > ^
> >
> > Huh. I'm quite surprised 0-day build service didn't warn on this.
> >
> > > Introduced by commit
> > >
> > > ed288d74a9e5 ("net/xprtrdma: Simplify ib_post_(send|recv|srq_recv)() calls")
> > >
> > > This is an actual problem.
> >
> > Yes, for sure. Bart?
>
> Thanks Stephen for having reported this. I propose to revert the changes in
> net/sunrpc/xprtrdma/svc_rdma_rw.c. Jason, do you want me to submit the below
> as a formal patch?
I applied the below.. Please let me know if there is an error.
Thanks,
Jason
commit 5d85a822fae2b484f26ddb09815063a88962a0cb
Author: Jason Gunthorpe <[email protected]>
Date: Thu Jul 26 11:36:50 2018 -0600
net/xprtrdma: Restore needed argument to ib_post_send
The call in svc_rdma_post_chunk_ctxt() does actually use bad_wr.
Fixes: ed288d74a9e5 ("net/xprtrdma: Simplify ib_post_(send|recv|srq_recv)() calls")
Reported-by: Stephen Rothwell <[email protected]>
Signed-off-by: Bart Van Assche <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
diff --git a/net/sunrpc/xprtrdma/svc_rdma_rw.c b/net/sunrpc/xprtrdma/svc_rdma_rw.c
index 80975427f5235f..ce3ea841970483 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_rw.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_rw.c
@@ -329,7 +329,7 @@ static int svc_rdma_post_chunk_ctxt(struct svc_rdma_chunk_ctxt *cc)
do {
if (atomic_sub_return(cc->cc_sqecount,
&rdma->sc_sq_avail) > 0) {
- ret = ib_post_send(rdma->sc_qp, first_wr, NULL);
+ ret = ib_post_send(rdma->sc_qp, first_wr, &bad_wr);
trace_svcrdma_post_rw(&cc->cc_cqe,
cc->cc_sqecount, ret);
if (ret)