From: Alejandro Colomar <alx+linux-hardening@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Alejandro Colomar <alx@kernel.org>, Kees Cook <kees@kernel.org>,
linux-hardening@vger.kernel.org,
Andy Shevchenko <andy@kernel.org>
Subject: Re: [PATCH] string: Add missing const
Date: Thu, 26 Nov 2026 22:49:25 +0100 [thread overview]
Message-ID: <awipH14MBd3rxgQj@devuan> (raw)
In-Reply-To: <awib7UleD4RO4K9v@ashevche-desk.local>
[-- Attachment #1: Type: text/plain, Size: 5092 bytes --]
Hi Andy,
> Date: 2026-11-26 22:51:57+0200
> From: Andy Shevchenko <andriy.shevchenko@intel.com>
>
> On Thu, Nov 26, 2026 at 04:55:07PM +0100, Alejandro Colomar wrote:
> > > On Wed, Nov 25, 2026 at 07:26:38PM +0100, Alejandro Colomar wrote:
> > > > This pointer is derived from other const pointers.
> > >
> > > Constification almost always is a good thing, if this builds and works as
> > > expected,
> >
> > Yup, I built it as part of a larger branch. I didn't run the tests,
> > but this should be a compile-time-only thing, so I don't think it's
> > necessary.
>
> Running kunit test is so-o easy! Just run
>
> ./tools/testing/kunit/kunit.py run string
>
> It will fail if compilation fails, so it's 2-in-1.
I've passed the tests now; see below.
Have a lovely night!
Alex
$ git log -1
commit 9331ce2afba1a44bb84f371581478a9ac5ee7380 (HEAD -> qchar)
Author: Alejandro Colomar <alx@kernel.org>
Date: 2026-11-25 19:25:10 +0100
string: Add missing const
This pointer is derived from other const pointers.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
$ cp ../kunitconfig .kunitconfig
$ cat .kunitconfig
CONFIG_KUNIT=y
CONFIG_STRING_KUNIT_TEST=y
$ mkdir -p ~/tmp/const-string1
$ export TMPDIR=$HOME/tmp/const-string1/
$ ./tools/testing/kunit/kunit.py run "string*"
[22:47:41] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[22:47:44] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json scripts_gdb ARCH=um O=.kunit --jobs=24
../drivers/base/dd.c: In function ‘__device_set_driver_override’:
../drivers/base/dd.c:406:20: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
406 | cp = strnchr(s, len, '\n');
| ^
[22:48:01] Starting KUnit Kernel (1/1)...
[22:48:01] ============================================================
Running tests with:
$ .kunit/linux 'kunit.filter_glob=string*' kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[22:48:02] ============= string-stream-test (12 subtests) =============
[22:48:02] [PASSED] string_stream_managed_init_test
[22:48:02] [PASSED] string_stream_unmanaged_init_test
[22:48:02] [PASSED] string_stream_managed_free_test
[22:48:02] [PASSED] string_stream_resource_free_test
[22:48:02] [PASSED] string_stream_line_add_test
[22:48:02] [PASSED] string_stream_variable_length_line_test
[22:48:02] [PASSED] string_stream_append_test
[22:48:02] [PASSED] string_stream_append_auto_newline_test
[22:48:02] [PASSED] string_stream_append_empty_string_test
[22:48:02] [PASSED] string_stream_no_auto_newline_test
[22:48:02] [PASSED] string_stream_auto_newline_test
[22:48:02] [PASSED] string_stream_performance_test
[22:48:02] =============== [PASSED] string-stream-test ================
[22:48:02] =================== string (29 subtests) ===================
[22:48:02] [PASSED] string_test_memset16
[22:48:02] [PASSED] string_test_memset32
[22:48:02] [PASSED] string_test_memset64
[22:48:02] [PASSED] string_test_strlen
[22:48:02] [PASSED] string_test_strnlen
[22:48:02] [PASSED] string_test_strchr
[22:48:02] [PASSED] string_test_strnchr
[22:48:02] [PASSED] string_test_strrchr
[22:48:02] [PASSED] string_test_strspn
[22:48:02] [PASSED] string_test_streq
[22:48:02] [PASSED] string_test_strcmp
[22:48:02] [PASSED] string_test_strcmp_long_strings
[22:48:02] [PASSED] string_test_strncmp
[22:48:02] [PASSED] string_test_strncmp_long_strings
[22:48:02] [PASSED] string_test_strcasecmp
[22:48:02] [PASSED] string_test_strcasecmp_long_strings
[22:48:02] [PASSED] string_test_strncasecmp
[22:48:02] [PASSED] string_test_strncasecmp_long_strings
[22:48:02] [PASSED] string_test_strscpy
[22:48:02] [PASSED] string_test_strcat
[22:48:02] [PASSED] string_test_strncat
[22:48:02] [PASSED] string_test_strlcat
[22:48:02] [PASSED] string_test_strtomem
[22:48:02] [PASSED] string_test_memtostr
[22:48:02] [PASSED] string_test_strends
[22:48:02] [SKIPPED] string_bench_strlen (not enabled)
[22:48:02] [SKIPPED] string_bench_strnlen (not enabled)
[22:48:02] [SKIPPED] string_bench_strchr (not enabled)
[22:48:02] [SKIPPED] string_bench_strrchr (not enabled)
[22:48:02] ===================== [PASSED] string ======================
[22:48:02] =============== string_helpers (4 subtests) ================
[22:48:02] [PASSED] test_get_size
[22:48:02] [PASSED] test_upper_lower
[22:48:02] [PASSED] test_unescape
[22:48:02] [PASSED] test_escape
[22:48:02] ================= [PASSED] string_helpers ==================
[22:48:02] ============================================================
[22:48:02] Testing complete. Ran 45 tests: passed: 41, skipped: 4
[22:48:02] Elapsed time: 20.674s total, 3.447s configuring, 17.058s building, 0.128s running
--
<https://www.alejandro-colomar.es>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2026-11-26 21:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 18:26 [PATCH] string: Add missing const Alejandro Colomar
2026-11-26 15:20 ` Andy Shevchenko
2026-11-26 15:55 ` Alejandro Colomar
2026-11-26 20:51 ` Andy Shevchenko
2026-11-26 21:49 ` Alejandro Colomar [this message]
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=awipH14MBd3rxgQj@devuan \
--to=alx+linux-hardening@kernel.org \
--cc=alx@kernel.org \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.