* [PATCH] RDMA/siw: Fix length of first chunk in siw_try_1seg()
@ 2026-09-27 11:53 Serhat Kumral
2026-09-27 12:05 ` sashiko-bot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Serhat Kumral @ 2026-09-27 11:53 UTC (permalink / raw)
To: Bernard Metzler, Jason Gunthorpe, Leon Romanovsky
Cc: linux-rdma, linux-kernel, Serhat Kumral
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@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] RDMA/siw: Fix length of first chunk in siw_try_1seg()
2026-09-27 11:53 [PATCH] RDMA/siw: Fix length of first chunk in siw_try_1seg() Serhat Kumral
@ 2026-09-27 12:05 ` sashiko-bot
2026-09-28 9:50 ` Bernard Metzler
2026-09-29 22:59 ` Jason Gunthorpe
2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-09-27 12:05 UTC (permalink / raw)
To: Serhat Kumral; +Cc: linux-rdma
> 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@gmail.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260927115351.12245-1-serhatkumral1@gmail.com?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] RDMA/siw: Fix length of first chunk in siw_try_1seg()
2026-09-27 11:53 [PATCH] RDMA/siw: Fix length of first chunk in siw_try_1seg() Serhat Kumral
2026-09-27 12:05 ` sashiko-bot
@ 2026-09-28 9:50 ` Bernard Metzler
2026-09-29 22:59 ` Jason Gunthorpe
2 siblings, 0 replies; 4+ messages in thread
From: Bernard Metzler @ 2026-09-28 9:50 UTC (permalink / raw)
To: Serhat Kumral, Jason Gunthorpe, Leon Romanovsky; +Cc: linux-rdma, linux-kernel
On 27.09.2026 13:53, Serhat Kumral wrote:
> 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@gmail.com>
> ---
> 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);
Excellent finding. Thanks very much Serhat.
This is quite serious, since we may copy data
from a location beyond the current page (if there
are more remaining bytes to be copied in the next
page than in the current page).
Acked-by: Bernard Metzler <bernard.metzler@linux.dev>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] RDMA/siw: Fix length of first chunk in siw_try_1seg()
2026-09-27 11:53 [PATCH] RDMA/siw: Fix length of first chunk in siw_try_1seg() Serhat Kumral
2026-09-27 12:05 ` sashiko-bot
2026-09-28 9:50 ` Bernard Metzler
@ 2026-09-29 22:59 ` Jason Gunthorpe
2 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2026-09-29 22:59 UTC (permalink / raw)
To: Serhat Kumral; +Cc: Bernard Metzler, Leon Romanovsky, linux-rdma, linux-kernel
On Sun, Sep 27, 2026 at 02:53:51PM +0300, Serhat Kumral wrote:
> 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@gmail.com>
> Acked-by: Bernard Metzler <bernard.metzler@linux.dev>
> ---
> drivers/infiniband/sw/siw/siw_qp_tx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to for-next, thanks
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-29 22:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-27 11:53 [PATCH] RDMA/siw: Fix length of first chunk in siw_try_1seg() Serhat Kumral
2026-09-27 12:05 ` sashiko-bot
2026-09-28 9:50 ` Bernard Metzler
2026-09-29 22:59 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox