lkml.org 
[lkml]   [2022]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] RDMA/srp: Set scmnd->result only when scmnd is not NULL
From


On 31/08/2022 10:31, Yang, Xiao/杨 晓 wrote:
> On 2022/8/31 9:59, Li Zhijian wrote:
>> What i can see is that we have other places to de-reference scmnd and
>>
>> scmnd = srp_claim_req(ch, req, NULL, scmnd) is possible to return a NULL
>> to scmnd
> Hi,
>
> Thanks for your review.
>
> Yes, it seems better to just check scmnd before setting scmnd->result,
> like this:
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c
> b/drivers/infiniband/ulp/srp/ib_srp.c
> index 7720ea270ed8..99f5e7f852b3 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -1972,7 +1972,9 @@ static void srp_process_rsp(struct srp_rdma_ch
> *ch, struct srp_rsp *rsp)
>
> return;
> }
> - scmnd->result = rsp->status;
> +
> + if (scmnd)
> + scmnd->result = rsp->status;
Not really, i think you may need to return directly if !scmnd


>
> Best Regards,
> Xiao Yang

\
 
 \ /
  Last update: 2022-08-31 05:04    [W:0.032 / U:1.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site