On Tue, Nov 05, 2024 at 08:08:39PM +0800, Junxian Huang wrote: > ib_map_mr_sg() and ib_map_mr_sg_pi() allow ULPs to specify NULL as > the sg_offset/data_sg_offset/meta_sg_offset arguments. Drivers who > need to derefernce these arguments have to add NULL pointer checks > to avoid crashing the kernel. > > This can be optimized by adding dummy sg_offset pointer to these > two APIs. When the sg_offset arguments are NULL, pass the pointer > of dummy to drivers. Drivers can always get a valid pointer, so no > need to add NULL pointer checks. > > Junxian Huang (2): > RDMA/core: Add dummy sg_offset pointer for ib_map_mr_sg() and > ib_map_mr_sg_pi() > RDMA: Delete NULL pointer checks for sg_offset in .map_mr_sg ops > > drivers/infiniband/core/verbs.c | 12 +++++++++--- > drivers/infiniband/hw/mlx5/mr.c | 18 ++++++------------ > drivers/infiniband/sw/rdmavt/trace_mr.h | 2 +- > 3 files changed, 16 insertions(+), 16 deletions(-) So what does this change give us? We have same functionality, same number of lines, same everything ... Thanks > > -- > 2.33.0 > >