The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2 1/2] RDMA/erdma: initialize ret for empty receive WR lists
@ 2026-06-18  4:17 Ruoyu Wang
  2026-06-18  4:17 ` [PATCH v2 2/2] RDMA/mana_ib: initialize err for empty send " Ruoyu Wang
  2026-07-02 17:17 ` [PATCH v2 1/2] RDMA/erdma: initialize ret for empty receive " Jason Gunthorpe
  0 siblings, 2 replies; 4+ messages in thread
From: Ruoyu Wang @ 2026-06-18  4:17 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky
  Cc: Cheng Xu, Kai Shen, Long Li, Konstantin Taranov, linux-rdma,
	linux-hyperv, linux-kernel, Ruoyu Wang

erdma_post_recv() returns ret after walking the receive work request list.
If the caller passes an empty list, the loop is skipped and ret is not
assigned.

Initialize ret to 0 so an empty receive work request list returns success
instead of stack data.

Fixes: 155055771704 ("RDMA/erdma: Add verbs implementation")
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
---
v2:
- Split the erdma and mana_ib changes into separate patches.
- Add a driver-specific Fixes tag.

 drivers/infiniband/hw/erdma/erdma_qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/erdma/erdma_qp.c b/drivers/infiniband/hw/erdma/erdma_qp.c
index 25f6c49aec779..e002343832f74 100644
--- a/drivers/infiniband/hw/erdma/erdma_qp.c
+++ b/drivers/infiniband/hw/erdma/erdma_qp.c
@@ -734,7 +734,7 @@ int erdma_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *recv_wr,
 	const struct ib_recv_wr *wr = recv_wr;
 	struct erdma_qp *qp = to_eqp(ibqp);
 	unsigned long flags;
-	int ret;
+	int ret = 0;
 
 	spin_lock_irqsave(&qp->lock, flags);
 
-- 
2.51.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] RDMA/mana_ib: initialize err for empty send WR lists
  2026-06-18  4:17 [PATCH v2 1/2] RDMA/erdma: initialize ret for empty receive WR lists Ruoyu Wang
@ 2026-06-18  4:17 ` Ruoyu Wang
  2026-06-19 17:09   ` [EXTERNAL] " Long Li
  2026-07-02 17:17 ` [PATCH v2 1/2] RDMA/erdma: initialize ret for empty receive " Jason Gunthorpe
  1 sibling, 1 reply; 4+ messages in thread
From: Ruoyu Wang @ 2026-06-18  4:17 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky
  Cc: Cheng Xu, Kai Shen, Long Li, Konstantin Taranov, linux-rdma,
	linux-hyperv, linux-kernel, Ruoyu Wang

mana_ib_post_send() returns err after walking the send work request list.
If the caller passes an empty list, the loop is skipped and err is not
assigned.

Initialize err to 0 so an empty send work request list returns success
instead of stack data.

Fixes: c8017f5b4856 ("RDMA/mana_ib: UD/GSI work requests")
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
---
v2:
- Split the erdma and mana_ib changes into separate patches.
- Add a driver-specific Fixes tag.

 drivers/infiniband/hw/mana/wr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mana/wr.c b/drivers/infiniband/hw/mana/wr.c
index 1813567d3b16c..36a1d506f08f6 100644
--- a/drivers/infiniband/hw/mana/wr.c
+++ b/drivers/infiniband/hw/mana/wr.c
@@ -144,7 +144,7 @@ static int mana_ib_post_send_ud(struct mana_ib_qp *qp, const struct ib_ud_wr *wr
 int mana_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
 		      const struct ib_send_wr **bad_wr)
 {
-	int err;
+	int err = 0;
 	struct mana_ib_qp *qp = container_of(ibqp, struct mana_ib_qp, ibqp);
 
 	for (; wr; wr = wr->next) {
-- 
2.51.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [EXTERNAL] [PATCH v2 2/2] RDMA/mana_ib: initialize err for empty send WR lists
  2026-06-18  4:17 ` [PATCH v2 2/2] RDMA/mana_ib: initialize err for empty send " Ruoyu Wang
@ 2026-06-19 17:09   ` Long Li
  0 siblings, 0 replies; 4+ messages in thread
From: Long Li @ 2026-06-19 17:09 UTC (permalink / raw)
  To: Ruoyu Wang, Jason Gunthorpe, Leon Romanovsky
  Cc: Cheng Xu, Kai Shen, Konstantin Taranov,
	linux-rdma@vger.kernel.org, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org

> mana_ib_post_send() returns err after walking the send work request list.
> If the caller passes an empty list, the loop is skipped and err is not assigned.
> 
> Initialize err to 0 so an empty send work request list returns success instead of
> stack data.
> 
> Fixes: c8017f5b4856 ("RDMA/mana_ib: UD/GSI work requests")
> Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>

Reviewed-by: Long Li <longli@microsoft.com>


> ---
> v2:
> - Split the erdma and mana_ib changes into separate patches.
> - Add a driver-specific Fixes tag.
> 
>  drivers/infiniband/hw/mana/wr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/mana/wr.c b/drivers/infiniband/hw/mana/wr.c
> index 1813567d3b16c..36a1d506f08f6 100644
> --- a/drivers/infiniband/hw/mana/wr.c
> +++ b/drivers/infiniband/hw/mana/wr.c
> @@ -144,7 +144,7 @@ static int mana_ib_post_send_ud(struct mana_ib_qp
> *qp, const struct ib_ud_wr *wr  int mana_ib_post_send(struct ib_qp *ibqp,
> const struct ib_send_wr *wr,
>                       const struct ib_send_wr **bad_wr)  {
> -       int err;
> +       int err = 0;
>         struct mana_ib_qp *qp = container_of(ibqp, struct mana_ib_qp, ibqp);
> 
>         for (; wr; wr = wr->next) {
> --
> 2.51.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] RDMA/erdma: initialize ret for empty receive WR lists
  2026-06-18  4:17 [PATCH v2 1/2] RDMA/erdma: initialize ret for empty receive WR lists Ruoyu Wang
  2026-06-18  4:17 ` [PATCH v2 2/2] RDMA/mana_ib: initialize err for empty send " Ruoyu Wang
@ 2026-07-02 17:17 ` Jason Gunthorpe
  1 sibling, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2026-07-02 17:17 UTC (permalink / raw)
  To: Ruoyu Wang
  Cc: Leon Romanovsky, Cheng Xu, Kai Shen, Long Li, Konstantin Taranov,
	linux-rdma, linux-hyperv, linux-kernel

On Thu, Jun 18, 2026 at 12:17:51PM +0800, Ruoyu Wang wrote:
> erdma_post_recv() returns ret after walking the receive work request list.
> If the caller passes an empty list, the loop is skipped and ret is not
> assigned.
> 
> Initialize ret to 0 so an empty receive work request list returns success
> instead of stack data.
> 
> Fixes: 155055771704 ("RDMA/erdma: Add verbs implementation")
> Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
> Reviewed-by: Cheng Xu <chengyou@linux.alibaba.com>
> ---
> v2:
> - Split the erdma and mana_ib changes into separate patches.
> - Add a driver-specific Fixes tag.
> 
>  drivers/infiniband/hw/erdma/erdma_qp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Both patches applied to for-rc

Thanks,
Jason

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-02 17:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-18  4:17 [PATCH v2 1/2] RDMA/erdma: initialize ret for empty receive WR lists Ruoyu Wang
2026-06-18  4:17 ` [PATCH v2 2/2] RDMA/mana_ib: initialize err for empty send " Ruoyu Wang
2026-06-19 17:09   ` [EXTERNAL] " Long Li
2026-07-02 17:17 ` [PATCH v2 1/2] RDMA/erdma: initialize ret for empty receive " Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox