From: "Tobin C. Harding" <me@tobin.cc>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "Tobin C. Harding" <tobin@kernel.org>,
Kees Cook <keescook@chromium.org>, Jann Horn <jannh@google.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Randy Dunlap <rdunlap@infradead.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Andy Lutomirski <luto@amacapital.net>,
Daniel Micay <danielmicay@gmail.com>,
Arnd Bergmann <arnd@arndb.de>,
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Shuah Khan <shuah@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Kernel Hardening <kernel-hardening@lists.openwall.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/1] lib/string: Add strscpy_pad() function
Date: Tue, 26 Feb 2019 08:31:09 +1100 [thread overview]
Message-ID: <20190225213109.GB5177@eros.localdomain> (raw)
In-Reply-To: <CAHp75Vfq5KQupcyx_84YcSOQ8mvNDvFE3R20KdyLEqEz74p3OQ@mail.gmail.com>
On Mon, Feb 25, 2019 at 10:19:47AM +0200, Andy Shevchenko wrote:
> On Mon, Feb 25, 2019 at 6:17 AM Tobin C. Harding <tobin@kernel.org> wrote:
> >
> > We have a function to copy strings safely and we have a function to copy
> > strings and zero the tail of the destination (if source string is
> > shorter than destination buffer) but we do not have a function to do
> > both at once. This means developers must write this themselves if they
> > desire this functionality. This is a chore, and also leaves us open to
> > off by one errors unnecessarily.
> >
> > Add a function that calls strscpy() then memset()s the tail to zero if
> > the source string is shorter than the destination buffer.
> >
> > Add test module for the new code.
>
> > --- /dev/null
> > +++ b/lib/test_strscpy.c
> > @@ -0,0 +1,175 @@
>
> > +// SPDX-License-Identifier: GPL-2.0
>
> > +MODULE_LICENSE("GPL");
>
> License mismatch.
Thanks, will re-spin with
// SPDX-License-Identifier: GPL-2.0+
> Do we need a separate module for this test?
Separate as in not in lib/test_string.h? I intend on moving the test
into that file once I've done some cleanup in tools/testing/selftest/lib/
I also tried to do this without using a module using
tools/testing/selftest/kselftest_harness.h but I could not get the
compiler to see read the patched version of
linux/include/linux/string.h?
Related question if you feel like answering it; why are test modules for
lib/ in lib/ and not in tools/testing/?
Very much open to suggestions on current best practices for kernel testing.
thanks,
Tobin.
next prev parent reply other threads:[~2019-02-25 21:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-25 4:15 [PATCH v2 0/1] lib/string: Add strscpy_pad() function Tobin C. Harding
2019-02-25 4:15 ` [PATCH v2 1/1] " Tobin C. Harding
2019-02-25 8:19 ` Andy Shevchenko
2019-02-25 21:31 ` Tobin C. Harding [this message]
2019-02-25 21:37 ` Tobin C. Harding
2019-02-25 21:38 ` Kees Cook
2019-02-27 4:40 ` Tobin C. Harding
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=20190225213109.GB5177@eros.localdomain \
--to=me@tobin.cc \
--cc=alexander.shishkin@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=arnd@arndb.de \
--cc=danielmicay@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo@embeddedor.com \
--cc=jannh@google.com \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=luto@amacapital.net \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=rdunlap@infradead.org \
--cc=sfr@canb.auug.org.au \
--cc=shuah@kernel.org \
--cc=tobin@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;
as well as URLs for NNTP newsgroup(s).