[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201019163449.0a3f4675@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Mon, 19 Oct 2020 16:34:49 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Kees Cook <keescook@...omium.org>
Cc: laniel_francis@...vacyrequired.com,
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 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;
;)
Powered by blists - more mailing lists