public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Wang Yufen <wangyufen@huawei.com>
Cc: bvanassche@acm.org, jgg@ziepe.ca, leon@kernel.org,
	dennis.dalessandro@cornelisnetworks.com,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	bart.vanassche@wdc.com, easwar.hariharan@intel.com
Subject: Re: [PATCH v2 2/2] RDMA/srp: Fix error return code in srp_parse_options()
Date: Sat, 26 Nov 2022 14:02:14 +0200	[thread overview]
Message-ID: <Y4IARpGaqfvHtu75@smile.fi.intel.com> (raw)
In-Reply-To: <1669433704-2254-2-git-send-email-wangyufen@huawei.com>

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?

> +			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?

> +out_with_einval:
> +	ret = -EINVAL;
>  out:
>  	kfree(options);
>  	return ret;

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2022-11-26 12:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-26  3:35 [PATCH v2 1/2] RDMA/hfi1: Fix error return code in parse_platform_config() Wang Yufen
2022-11-26  3:35 ` [PATCH v2 2/2] RDMA/srp: Fix error return code in srp_parse_options() Wang Yufen
2022-11-26 12:02   ` Andy Shevchenko [this message]
2022-11-26 12:03     ` Andy Shevchenko
2022-11-26 13:19       ` wangyufen
2022-11-26 13:19     ` wangyufen
2022-11-26 12:04 ` [PATCH v2 1/2] RDMA/hfi1: Fix error return code in parse_platform_config() Andy Shevchenko

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=Y4IARpGaqfvHtu75@smile.fi.intel.com \
    --to=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 \
    --cc=wangyufen@huawei.com \
    /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