Re: [PATCH] xprtrdma: Fix a maybe-uninitialized compiler warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2021-10-31 at 15:04 +0000, Chuck Lever III wrote:
> 
> 
> > On Oct 31, 2021, at 9:08 AM, Benjamin Coddington
> > <bcodding@xxxxxxxxxx> wrote:
> > 
> > This minor fix-up keeps GCC from complaining that "last' may be used
> > uninitialized", which breaks some build workflows that have been
> > running
> > with all warnings treated as errors.
> > 
> > Signed-off-by: Benjamin Coddington <bcodding@xxxxxxxxxx>
> 
> Reviewed-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
> 
> 
> > ---
> > net/sunrpc/xprtrdma/frwr_ops.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/net/sunrpc/xprtrdma/frwr_ops.c
> > b/net/sunrpc/xprtrdma/frwr_ops.c
> > index f700b34a5bfd..de813fa07daa 100644
> > --- a/net/sunrpc/xprtrdma/frwr_ops.c
> > +++ b/net/sunrpc/xprtrdma/frwr_ops.c
> > @@ -503,7 +503,7 @@ static void frwr_wc_localinv_wake(struct ib_cq
> > *cq, struct ib_wc *wc)
> >  */
> > void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req
> > *req)
> > {
> > -       struct ib_send_wr *first, **prev, *last;
> > +       struct ib_send_wr *first, **prev, *last = NULL;
> >         struct rpcrdma_ep *ep = r_xprt->rx_ep;
> >         const struct ib_send_wr *bad_wr;
> >         struct rpcrdma_mr *mr;

Err... Definitely not sufficient.

gcc is absolutely correct to complain here, because if req-
>rl_registered is empty, then the whole rest of the function after that
while() loop is invalid.

> > @@ -608,7 +608,7 @@ static void frwr_wc_localinv_done(struct ib_cq
> > *cq, struct ib_wc *wc)
> >  */
> > void frwr_unmap_async(struct rpcrdma_xprt *r_xprt, struct
> > rpcrdma_req *req)
> > {
> > -       struct ib_send_wr *first, *last, **prev;
> > +       struct ib_send_wr *first, *last = NULL, **prev;
> >         struct rpcrdma_ep *ep = r_xprt->rx_ep;
> >         struct rpcrdma_mr *mr;
> >         int rc;
> > -- 
> > 2.31.1
> > 

Ditto.

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@xxxxxxxxxxxxxxx






[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux