Hi Andy, > Date: 2026-11-26 22:51:57+0200 > From: Andy Shevchenko > > 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 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 $ 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 --