public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Julia Lawall <julia@diku.dk>,
	"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 20:45:55 +0000	[thread overview]
Message-ID: <20111108204555.GA4379@p183.telecom.by> (raw)
In-Reply-To: <alpine.DEB.2.02.1111082113380.1880@hadrien>

On Tue, Nov 08, 2011 at 09:19:30PM +0100, Julia Lawall wrote:
> 
> 
> On Tue, 8 Nov 2011, Alexey Dobriyan wrote:
> 
> > 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!
> 
> Sorry, this was not the real rule I used for the strtoul case.  Instead I 
> used the following:
> 
> @@
> typedef ulong;
> expression a,b;
> {ulong,unsigned long,unsigned int,size_t} *c;
> @@
> 
> -strict_strtoul
> +kstrtoul
>   (a,b,c)
> 
> But now I have seen that there is a separate function for integers, so I 
> have made a rule to use that function when the type is unsigned int.
> 
> > In every case see the type or real data and use appropriate function.
> > kstrtou8() for ports.
> 
> The type of the destination variable in all of these cases is unsigned 
> long.  But maybe that is not enough information to make the 
> transformation in the right way.

That's because previous functions following libc didn't accept anything
less than unsigned long.

For these conversion, one should literally look at every usecase and
see what types data have for real (not unsigned long) and
make conversion and remove explicit EINVAL checks if necesasry.

In sunrpc case: switch to kstrtou8 + remove "> 255" check.

This program doesn't and won't do that.

  reply	other threads:[~2011-11-08 20:45 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
2011-11-08 20:19     ` Julia Lawall
2011-11-08 20:45       ` Alexey Dobriyan [this message]
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=20111108204555.GA4379@p183.telecom.by \
    --to=adobriyan@gmail.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=davem@davemloft.net \
    --cc=julia.lawall@lip6.fr \
    --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