[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <01fc11f9-b798-f690-32d9-7f4d577a8e82@huawei.com>
Date: Sat, 26 Nov 2022 09:23:20 +0800
From: wangyufen <wangyufen@...wei.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
CC: <bvanassche@....org>, <jgg@...pe.ca>, <leon@...nel.org>,
<dennis.dalessandro@...nelisnetworks.com>,
<linux-rdma@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<bart.vanassche@....com>, <easwar.hariharan@...el.com>
Subject: Re: [PATCH 2/2] RDMA/srp: Fix error return code in
srp_parse_options()
在 2022/11/25 22:37, Andy Shevchenko 写道:
> On Fri, Nov 25, 2022 at 08:03:51PM +0800, Wang Yufen wrote:
>> In the previous while loop, "ret" may be assigned zero. Therefore,
>> "ret" needs to be assigned -EINVAL at the beginning of each loop.
>
> ...
>
>> while ((p = strsep(&sep_opt, ",\n")) != NULL) {
>> + ret = -EINVAL;
>> if (!*p)
>> continue;
>
> Better option is to investigate each case separately and gather all of them
> into a single fix.
>
> For example, this
>
> case SRP_OPT_MAX_IT_IU_SIZE:
> if (match_int(args, &token) || token < 0) {
> pr_warn("bad maximum initiator to target IU size '%s'\n", p);
> goto out;
> }
> target->max_it_iu_size = token;
> break;
>
> can be rewritten as
>
> case SRP_OPT_MAX_IT_IU_SIZE:
> ret = match_int(args, &token);
> if (ret)
> goto out;
> if (token < 0) {
> pr_warn("bad maximum initiator to target IU size '%s'\n", p);
> ret = -EINVAL;
> goto out;
> }
> target->max_it_iu_size = token;
> break;
>
> and so on...
>
I got it. Will change in v2.
Thanks!
Powered by blists - more mailing lists