[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202009061325.8B4A75057@keescook>
Date: Sun, 6 Sep 2020 13:26:32 -0700
From: Kees Cook <keescook@...omium.org>
To: Arvind Sankar <nivedita@...m.mit.edu>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Hans de Goede <hdegoede@...hat.com>,
Joe Perches <joe@...ches.com>,
Masahiro Yamada <masahiroy@...nel.org>,
Yury Norov <yury.norov@...il.com>,
Alexandru Ardelean <alexandru.ardelean@...log.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib/string.c: Clarify kerndoc for stpcpy()
On Sun, Sep 06, 2020 at 12:08:09PM -0400, Arvind Sankar wrote:
> On Sun, Sep 06, 2020 at 03:06:29AM -0700, Kees Cook wrote:
> > Fix the language around return values to indicate destination instead of
> > source.
> >
> > Reported-by: Masahiro Yamada <masahiroy@...nel.org>
> > Link: https://lore.kernel.org/lkml/CAK7LNAQvQBhjYgSkvm-dVyNz2Jd2C2qAtfyRk-rngEDfjkc38g
> > Cc: Nick Desaulniers <ndesaulniers@...gle.com>
> > Signed-off-by: Kees Cook <keescook@...omium.org>
> > ---
> > This is a fix for lib-stringc-implement-stpcpy.patch in -mm.
> >
> > Andrew, please note that it would be nice to get this into -rc6
> > to unbreak the clang builds.
> >
> > Thanks!
> > ---
> > lib/string.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/lib/string.c b/lib/string.c
> > index 6bd0cf0fb009..32a56436c7eb 100644
> > --- a/lib/string.c
> > +++ b/lib/string.c
> > @@ -280,12 +280,12 @@ EXPORT_SYMBOL(strscpy_pad);
> > * @src: pointer to the beginning of string being copied from. Must not overlap
> > * dest.
> > *
> > - * stpcpy differs from strcpy in a key way: the return value is the new
> > - * %NUL-terminated character. (for strcpy, the return value is a pointer to
> > - * src. This interface is considered unsafe as it doesn't perform bounds
> > - * checking of the inputs. As such it's not recommended for usage. Instead,
> > - * its definition is provided in case the compiler lowers other libcalls to
> > - * stpcpy.
> > + * stpcpy differs from strcpy in a key way: the return value is a pointer
> > + * to the new %NUL-terminated character in @dest. (For strcpy, the return
> > + * value is a pointer to the start of @dest. This interface is considered
> ^ need closing parenthesis
>
> Thanks.
*face in hands* Yup. Andrew, do you want to poke that yourself or should
I send a fix-fix? :)
--
Kees Cook
Powered by blists - more mailing lists