diff mbox series

[01/31] rdma/siw: fix warning in siw_proc_send()

Message ID 1aa26782ef60cc69aa49886a4c478fbbf74a186e.1620343860.git.metze@samba.org (mailing list archive)
State Changes Requested
Headers show
Series rdma/siw: fix a lot of deadlocks and use after free bugs | expand

Commit Message

Stefan Metzmacher May 6, 2021, 11:36 p.m. UTC
CC [M]  drivers/infiniband/sw/siw/siw_qp_rx.o
In file included from ./include/linux/wait.h:9:0,
                 from ./include/linux/net.h:19,
                 from drivers/infiniband/sw/siw/siw_qp_rx.c:8:
drivers/infiniband/sw/siw/siw_qp_rx.c: In function ‘siw_proc_send’:
./include/linux/spinlock.h:288:3: warning: ‘flags’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   _raw_spin_unlock_irqrestore(lock, flags); \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/sw/siw/siw_qp_rx.c:335:16: note: ‘flags’ was declared here
  unsigned long flags;

Fixes: 6c52fdc244b5 ("rdma/siw: connection management")
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Cc: Bernard Metzler <bmt@zurich.ibm.com>
Cc: linux-rdma@vger.kernel.org
---
 drivers/infiniband/sw/siw/siw_qp_rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bernard Metzler May 7, 2021, 12:15 p.m. UTC | #1
-----"Stefan Metzmacher" <metze@samba.org> wrote: -----

>To: "Bernard Metzler" <bmt@zurich.ibm.com>
>From: "Stefan Metzmacher" <metze@samba.org>
>Date: 05/07/2021 01:37AM
>Cc: linux-rdma@vger.kernel.org, "Stefan Metzmacher" <metze@samba.org>
>Subject: [EXTERNAL] [PATCH 01/31] rdma/siw: fix warning in
>siw_proc_send()
>
>  CC [M]  drivers/infiniband/sw/siw/siw_qp_rx.o
>In file included from ./include/linux/wait.h:9:0,
>                 from ./include/linux/net.h:19,
>                 from drivers/infiniband/sw/siw/siw_qp_rx.c:8:
>drivers/infiniband/sw/siw/siw_qp_rx.c: In function ‘siw_proc_send’:
>./include/linux/spinlock.h:288:3: warning: ‘flags’ may be used
>uninitialized in this function [-Wmaybe-uninitialized]
>   _raw_spin_unlock_irqrestore(lock, flags); \
>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>drivers/infiniband/sw/siw/siw_qp_rx.c:335:16: note: ‘flags’ was
>declared here
>  unsigned long flags;
>
>Fixes: 6c52fdc244b5 ("rdma/siw: connection management")
>Signed-off-by: Stefan Metzmacher <metze@samba.org>
>Cc: Bernard Metzler <bmt@zurich.ibm.com>
>Cc: linux-rdma@vger.kernel.org
>---
> drivers/infiniband/sw/siw/siw_qp_rx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/infiniband/sw/siw/siw_qp_rx.c
>b/drivers/infiniband/sw/siw/siw_qp_rx.c
>index 60116f20653c..0170c05d2cc3 100644
>--- a/drivers/infiniband/sw/siw/siw_qp_rx.c
>+++ b/drivers/infiniband/sw/siw/siw_qp_rx.c
>@@ -333,7 +333,7 @@ static struct siw_wqe *siw_rqe_get(struct siw_qp
>*qp)
> 	struct siw_srq *srq;
> 	struct siw_wqe *wqe = NULL;
> 	bool srq_event = false;
>-	unsigned long flags;
>+	unsigned long flags = 0;
> 
This is not needed. flags are only used if 'srq'
is valid. 'srq' dosen't get reassigned after first check.
Somehow the compiler warning is a false negative.


> 	srq = qp->srq;
> 	if (srq) {
>-- 
>2.25.1
>
>
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/siw/siw_qp_rx.c b/drivers/infiniband/sw/siw/siw_qp_rx.c
index 60116f20653c..0170c05d2cc3 100644
--- a/drivers/infiniband/sw/siw/siw_qp_rx.c
+++ b/drivers/infiniband/sw/siw/siw_qp_rx.c
@@ -333,7 +333,7 @@  static struct siw_wqe *siw_rqe_get(struct siw_qp *qp)
 	struct siw_srq *srq;
 	struct siw_wqe *wqe = NULL;
 	bool srq_event = false;
-	unsigned long flags;
+	unsigned long flags = 0;
 
 	srq = qp->srq;
 	if (srq) {