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] [day] [month] [year] [list]
Message-ID: <202010201022.B016A3A41A@keescook>
Date:   Tue, 20 Oct 2020 10:23:09 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Francis Laniel <laniel_francis@...vacyrequired.com>
Cc:     Jakub Kicinski <kuba@...nel.org>, linux-hardening@...r.kernel.org,
        davem@...emloft.net
Subject: Re: [RFC][PATCH v2 2/3] Modify return value of nla_strlcpy to match
 that of strscpy.

On Tue, Oct 20, 2020 at 12:28:49PM +0200, Francis Laniel wrote:
> Le mardi 20 octobre 2020, 01:34:49 CEST Jakub Kicinski a écrit :
> > On Mon, 19 Oct 2020 16:01:27 -0700 Kees Cook wrote:
> > > On Mon, Oct 19, 2020 at 09:43:55AM -0700, Jakub Kicinski wrote:
> > > > On Mon, 19 Oct 2020 17:23:30 +0200 laniel_francis@...vacyrequired.com
> > > > 
> > > > wrote:
> > > > > -size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t
> > > > > dstsize)
> > > > > +ssize_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t
> > > > > dstsize)
> > > > > 
> > > > >  {
> > > > > 
> > > > > +	size_t len;
> > > > > +	ssize_t ret;
> > > > > 
> > > > >  	size_t srclen = nla_len(nla);
> > > > >  	char *src = nla_data(nla);
> > > > 
> > > > Sort local variables long to short.
> > > 
> > > Specifically, "reverse christmas tree":
> > >  	size_t srclen = nla_len(nla);
> > >  	char *src = nla_data(nla);
> > >  	size_t len;
> > >  	ssize_t ret;
> > 
> > Or even
> > 
> >  	size_t srclen = nla_len(nla);
> >  	char *src = nla_data(nla);
> >  	ssize_t ret;
> >  	size_t len;
> > 
> > ;)
> 
> I reordered the variables names for the v3.
> Just to know, is it a new rule? Because scripts/checkpatch.pl did not report 
> anything and I was not aware of it.

This is specific to netdev, but I actually can't find reference to this
in either Documentation/process/coding-style.rst nor
Documentation/networking/netdev-FAQ.rst.

I swear I found this written down before, but it eludes me now.

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ