From: wangyufen <wangyufen@huawei.com>
To: Bart Van Assche <bvanassche@acm.org>, <jgg@ziepe.ca>,
<leon@kernel.org>, <dennis.dalessandro@cornelisnetworks.com>
Cc: <linux-rdma@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<andriy.shevchenko@linux.intel.com>, <bart.vanassche@wdc.com>,
<easwar.hariharan@intel.com>
Subject: Re: [PATCH v4 2/2] RDMA/srp: Fix error return code in srp_parse_options()
Date: Wed, 30 Nov 2022 11:31:32 +0800 [thread overview]
Message-ID: <65604aae-b722-4caf-3373-d0f1e4492faa@huawei.com> (raw)
In-Reply-To: <b4d78eb0-4492-ac7f-d500-3d49b0dc7aa1@acm.org>
I'm so sorry for the poor patch description. Is the following
description OK?
In the previous iteration of the while loop, "ret" may have been
assigned a value of 0, so the error return code -EINVAL may have been
incorrectly set to 0.
Also, investigate each case separately as Andy suggessted. If the help
function match_int() fails, the error code is returned, which is
different from the warning information printed before. If the parsing
result token is incorrect, "-EINVAL" is returned and the original
warning information is printed.
Thanks.
在 2022/11/30 2:43, Bart Van Assche 写道:
> On 11/28/22 18:04, Wang Yufen wrote:
>> In the previous while loop, "ret" may be assigned zero, , so the error
>
> The word "iteration" is missing from the above sentence. Additionally,
> there is a double comma.
>
>> return code may be incorrectly set to 0 instead of -EINVAL. Alse
>
> Alse -> Also
>
>> case SRP_OPT_QUEUE_SIZE:
>> - if (match_int(args, &token) || token < 1) {
>> + ret = match_int(args, &token);
>> + if (ret)
>> + goto out;
>> + if (token < 1) {
>> pr_warn("bad queue_size parameter '%s'\n", p);
>> + ret = -EINVAL;
>> goto out;
>> }
>> target->scsi_host->can_queue = token;
>
> Why only to report "bad queue_size parameter" if ret == 0 && token < 1
> but not if ret < 0? This is a behavior change that has not been
> explained in the patch description.
>
>> @@ -3490,25 +3496,34 @@ static int srp_parse_options(struct net *net,
>> const char *buf,
>> break;
>> case SRP_OPT_MAX_CMD_PER_LUN:
>> - if (match_int(args, &token) || token < 1) {
>> + ret = match_int(args, &token);
>> + if (ret)
>> + goto out;
>> + if (token < 1) {
>> pr_warn("bad max cmd_per_lun parameter '%s'\n",
>> p);
>> + ret = -EINVAL;
>> goto out;
>> }
>> target->scsi_host->cmd_per_lun = token;
>> break;
>
> Same comment here and for many other changes below.
>
> Thanks,
>
> Bart.
>
>
next prev parent reply other threads:[~2022-11-30 3:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 2:04 [PATCH v4 1/2] RDMA/hfi1: Fix error return code in parse_platform_config() Wang Yufen
2022-11-29 2:04 ` [PATCH v4 2/2] RDMA/srp: Fix error return code in srp_parse_options() Wang Yufen
2022-11-29 18:43 ` Bart Van Assche
2022-11-30 3:31 ` wangyufen [this message]
2022-11-30 18:00 ` Bart Van Assche
2022-12-01 1:37 ` wangyufen
2022-12-01 1:49 ` wangyufen
2022-12-01 12:21 ` Andy Shevchenko
2022-11-29 8:56 ` [PATCH v4 1/2] RDMA/hfi1: Fix error return code in parse_platform_config() Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=65604aae-b722-4caf-3373-d0f1e4492faa@huawei.com \
--to=wangyufen@huawei.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bart.vanassche@wdc.com \
--cc=bvanassche@acm.org \
--cc=dennis.dalessandro@cornelisnetworks.com \
--cc=easwar.hariharan@intel.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox