kunit: test: Make filter strings in executor_test writable
authorDavid Gow <davidgow@google.com>
Wed, 30 Aug 2023 00:21:15 +0000 (08:21 +0800)
committerShuah Khan <skhan@linuxfoundation.org>
Fri, 1 Sep 2023 15:09:25 +0000 (09:09 -0600)
commitdce19a3fede254fd11e0013f1c6fe3bfc37a4d73
tree555456140060a83ad2de01124374ce443ef13854
parent25e324bc9cf2ee956eec1db384c39c1a17b7c44a
kunit: test: Make filter strings in executor_test writable

KUnit's attribute filtering feature needs the filter strings passed in
to be writable, as it modifies them in-place during parsing. This works
for the filters passed on the kernel command line, but the string
literals used in the executor tests are at least theoretically read-only
(though they work on x86_64 for some reason). s390 wasn't fooled, and
crashed when these tests were run.

Use a 'char[]' instead, (and make an explicit variable for the current
filter in parse_filter_attr_test), which will store the string in a
writable segment.

Fixes: 76066f93f1df ("kunit: add tests for filtering attributes")
Closes: https://lore.kernel.org/linux-kselftest/55950256-c00a-4d21-a2c0-cf9f0e5b8a9a@roeck-us.net/
Signed-off-by: David Gow <davidgow@google.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Rae Moar <rmoar@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
lib/kunit/executor_test.c