]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/mana_ib: initialize err for empty send WR lists
authorRuoyu Wang <ruoyuw560@gmail.com>
Thu, 18 Jun 2026 04:17:52 +0000 (12:17 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 2 Jul 2026 17:16:44 +0000 (14:16 -0300)
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")
Link: https://patch.msgid.link/r/20260618041752.481193-2-ruoyuw560@gmail.com
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/mana/wr.c

index 1813567d3b16c9b16264d6df60c84ca502265c1b..36a1d506f08f65a6337217f4eed95a48754ab7ea 100644 (file)
@@ -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) {