]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/erdma: initialize ret for empty receive WR lists
authorRuoyu Wang <ruoyuw560@gmail.com>
Thu, 18 Jun 2026 04:17:51 +0000 (12:17 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 2 Jul 2026 17:16:44 +0000 (14:16 -0300)
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")
Link: https://patch.msgid.link/r/20260618041752.481193-1-ruoyuw560@gmail.com
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
Reviewed-by: Cheng Xu <chengyou@linux.alibaba.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/erdma/erdma_qp.c

index 25f6c49aec77989c3eddbc82e291796a9425393c..e002343832f74d0834c270427035f49c71f44431 100644 (file)
@@ -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);