public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org,
	David Vrabel <david.vrabel@citrix.com>,
	xen-devel@lists.xenproject.org,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [Xen-devel] [patch] xen-scsiback: clean up a type issue in scsiback_make_tpg()
Date: Mon, 08 Sep 2014 13:31:57 +0200	[thread overview]
Message-ID: <540D93AD.3050500@suse.com> (raw)
In-Reply-To: <20140908111735.GB6947@mwanda>

On 09/08/2014 01:17 PM, Dan Carpenter wrote:
> This code was confusing because we had an unsigned long and then we
> compared it to UINT_MAX and then we stored it in a u16.  How many bytes
> is this supposed to have: 2, 4 or 16???
>
> I've made it a u16 throughout.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Juergen Gross <jgross@suse.com>

Thanks,

Juergen

>
> diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
> index 7b565632..ad11258 100644
> --- a/drivers/xen/xen-scsiback.c
> +++ b/drivers/xen/xen-scsiback.c
> @@ -1885,13 +1885,14 @@ scsiback_make_tpg(struct se_wwn *wwn,
>   			struct scsiback_tport, tport_wwn);
>
>   	struct scsiback_tpg *tpg;
> -	unsigned long tpgt;
> +	u16 tpgt;
>   	int ret;
>
>   	if (strstr(name, "tpgt_") != name)
>   		return ERR_PTR(-EINVAL);
> -	if (kstrtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX)
> -		return ERR_PTR(-EINVAL);
> +	ret = kstrtou16(name + 5, 10, &tpgt);
> +	if (ret)
> +		return ERR_PTR(ret);
>
>   	tpg = kzalloc(sizeof(struct scsiback_tpg), GFP_KERNEL);
>   	if (!tpg)
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>


      reply	other threads:[~2014-09-08 11:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-08 11:17 [patch] xen-scsiback: clean up a type issue in scsiback_make_tpg() Dan Carpenter
2014-09-08 11:31 ` Juergen Gross [this message]

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=540D93AD.3050500@suse.com \
    --to=jgross@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=dan.carpenter@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.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