]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
string: kunit: Mark nonstring test strings as __nonstring
authorKees Cook <kees@kernel.org>
Thu, 6 Feb 2025 23:24:37 +0000 (15:24 -0800)
committerKees Cook <kees@kernel.org>
Fri, 28 Feb 2025 19:51:32 +0000 (11:51 -0800)
In preparation for strtomem*() checking that its destination is a
__nonstring, annotate "nonstring" and "nonstring_small" variables
accordingly.

Signed-off-by: Kees Cook <kees@kernel.org>
lib/string_kunit.c

index c919e3293da6aa562582fa14c471d092a985023f..0ed7448a26d3aa0fe9e2a6a894d4c49c2c0b86e0 100644 (file)
@@ -579,8 +579,8 @@ static void string_test_strtomem(struct kunit *test)
 
 static void string_test_memtostr(struct kunit *test)
 {
-       char nonstring[7] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g' };
-       char nonstring_small[3] = { 'a', 'b', 'c' };
+       char nonstring[7] __nonstring = { 'a', 'b', 'c', 'd', 'e', 'f', 'g' };
+       char nonstring_small[3] __nonstring = { 'a', 'b', 'c' };
        char dest[sizeof(nonstring) + 1];
 
        /* Copy in a non-NUL-terminated string into exactly right-sized dest. */