[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <372591f3-c7c3-4c50-dad7-fcd386454709@huawei.com>
Date: Sat, 26 Nov 2022 21:19:07 +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 v2 2/2] RDMA/srp: Fix error return code in
srp_parse_options()
在 2022/11/26 20:02, Andy Shevchenko 写道:
> On Sat, Nov 26, 2022 at 11:35:04AM +0800, Wang Yufen wrote:
>> In the previous while loop, "ret" may be assigned zero, , so the error
>> return code may be incorrectly set to 0 instead of -EINVAL.
>> Add out_with_einval goto label and covert all "goto out;" to "goto
>> out_with_einval:" where it's appropriate, alse investigate each case
>> separately as Andy suggessted.
>
> It's better now, though you missed something...
>
> ...
>
>> case SRP_OPT_TARGET_CAN_QUEUE:
>> - if (match_int(args, &token) || token < 1) {
>> + ret = match_int(args, &token);
>
> Check for ret?
Yes, there's a ret check missing here, will change in v3
>
>> + if (token < 1) {
>> pr_warn("bad max target_can_queue parameter '%s'\n",
>> p);
>> - goto out;
>> + goto out_with_einval;
>> }
>> target->target_can_queue = token;
>> break;
>
> ...
>
>> target->scsi_host->can_queue);
>
> The below can't be like this, right?
Yes, I'm sorry for the breakage, also will change in v3
Thanks!
>
>> +out_with_einval:
>> + ret = -EINVAL;
>> out:
>> kfree(options);
>> return ret;
>
Powered by blists - more mailing lists