[PATCH] RDMA/siw: Fix length of first chunk in siw_try_1seg()

From: Serhat Kumral

Date: Sun Sep 27 2026 - 07:56:53 EST


When a short-single SGE payload crosses a page boundary, siw_try_1seg()
computes the length of the first chunk as the amount that spills into
the second page instead of the amount left in the first page

part = bytes - (PAGE_SIZE - off);

Use the remaining length of the first page as the first chunk.

Fixes: b9be6f18cf9e ("rdma/siw: transmit path")
Assisted-by: LLM
Signed-off-by: Serhat Kumral <serhatkumral1@xxxxxxxxx>
---
drivers/infiniband/sw/siw/siw_qp_tx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c b/drivers/infiniband/sw/siw/siw_qp_tx.c
index f7dd32c6e5ba..54c9d97015e8 100644
--- a/drivers/infiniband/sw/siw/siw_qp_tx.c
+++ b/drivers/infiniband/sw/siw/siw_qp_tx.c
@@ -85,7 +85,7 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)
if (likely(PAGE_SIZE - off >= bytes)) {
memcpy(paddr, buffer + off, bytes);
} else {
- unsigned long part = bytes - (PAGE_SIZE - off);
+ unsigned long part = PAGE_SIZE - off;

memcpy(paddr, buffer + off, part);
kunmap_local(buffer);
--
2.53.0