Re: [PATCH v3 1/2] RDMA/srpt: bound the indirect descriptor table to the IU

From: Bart Van Assche

Date: Thu Oct 22 2026 - 11:56:33 EST


On 10/22/26 7:39 AM, Yehyeong Lee wrote:
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 7197d95f2216b..97758082f71d2 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -1117,6 +1117,8 @@ static int srpt_get_desc_tbl(struct srpt_recv_ioctx *recv_ioctx,
struct srp_indirect_buf *idb = srpt_get_desc_buf(srp_cmd);
int nbufs = be32_to_cpu(idb->table_desc.len) /
sizeof(struct srp_direct_buf);
+ int desc_off = (u8 *)idb - (u8 *)srp_cmd;

The idiomatic way in the kernel for subtracting pointers is to convert
these to uintptr_t instead of u8 * before subtracting.

Thanks,

Bart.