public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Julia Lawall <julia@diku.dk>
Cc: "J. Bruce Fields" <bfields@fieldses.org>,
	kernel-janitors@vger.kernel.org, Neil Brown <neilb@suse.de>,
	Trond Myklebust <Trond.Myklebust@netapp.com>,
	"David S. Miller" <davem@davemloft.net>,
	linux-nfs@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] net/sunrpc: use kstrtoul, etc
Date: Tue, 08 Nov 2011 19:38:18 +0000	[thread overview]
Message-ID: <20111108193817.GA3453@p183.telecom.by> (raw)
In-Reply-To: <1320586010-21931-3-git-send-email-julia@diku.dk>

On Sun, Nov 06, 2011 at 02:26:47PM +0100, Julia Lawall wrote:
> @@
> expression a,b;
> {int,long} *c;
> @@
> 
> -strict_strtoul
> +kstrtoul

No, no, no!

In every case see the type or real data and use appropriate function.
kstrtou8() for ports.
This program creates lots of bogus patches in this case.

> --- a/net/sunrpc/addr.c
> +++ b/net/sunrpc/addr.c
> @@ -322,7 +322,7 @@ size_t rpc_uaddr2sockaddr(const char *ua
>  	c = strrchr(buf, '.');
>  	if (unlikely(c = NULL))
>  		return 0;
> -	if (unlikely(strict_strtoul(c + 1, 10, &portlo) != 0))
> +	if (unlikely(kstrtoul(c + 1, 10, &portlo) != 0))
>  		return 0;
>  	if (unlikely(portlo > 255))
>  		return 0;
> @@ -331,7 +331,7 @@ size_t rpc_uaddr2sockaddr(const char *ua
>  	c = strrchr(buf, '.');
>  	if (unlikely(c = NULL))
>  		return 0;
> -	if (unlikely(strict_strtoul(c + 1, 10, &porthi) != 0))
> +	if (unlikely(kstrtoul(c + 1, 10, &porthi) != 0))
>  		return 0;
>  	if (unlikely(porthi > 255))
>  		return 0;

  reply	other threads:[~2011-11-08 19:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-06 13:26 [PATCH 0/5] use kstrtoul, etc Julia Lawall
2011-11-06 13:26 ` [PATCH 1/5] net/batman-adv: " Julia Lawall
2011-11-06 14:16   ` [B.A.T.M.A.N.] " Marek Lindner
2011-11-06 13:26 ` [PATCH 2/5] net/sunrpc: " Julia Lawall
2011-11-08 19:38   ` Alexey Dobriyan [this message]
2011-11-08 20:19     ` Julia Lawall
2011-11-08 20:45       ` Alexey Dobriyan
2011-11-09  6:15       ` Julia Lawall
2011-11-06 13:26 ` [PATCH 3/5] net/mac80211/debugfs.c: " Julia Lawall
2011-11-07 11:47   ` Eliad Peller
2011-11-07 11:58     ` Julia Lawall
2011-11-06 13:26 ` [PATCH 4/5] net/rfkill/core.c: " Julia Lawall
2011-11-06 13:26 ` [PATCH 5/5] net/dns_resolver/dns_key.c: " Julia Lawall

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=20111108193817.GA3453@p183.telecom.by \
    --to=adobriyan@gmail.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=davem@davemloft.net \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=netdev@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