lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111108204555.GA4379@p183.telecom.by>
Date:	Tue, 8 Nov 2011 23:45:55 +0300
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	Julia Lawall <julia.lawall@...6.fr>
Cc:	Julia Lawall <julia@...u.dk>,
	"J. Bruce Fields" <bfields@...ldses.org>,
	kernel-janitors@...r.kernel.org, Neil Brown <neilb@...e.de>,
	Trond Myklebust <Trond.Myklebust@...app.com>,
	"David S. Miller" <davem@...emloft.net>, linux-nfs@...r.kernel.org,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/5] net/sunrpc: use kstrtoul, etc

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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ