summaryrefslogtreecommitdiff
path: root/lib/stackinit_kunit.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-02-08 14:12:17 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2025-02-08 14:12:17 -0800
commit9946eaf552b194bb352c2945b54ff98c8193b3f1 (patch)
treecc622115393fd9ba99f466fbdce551b60867e200 /lib/stackinit_kunit.c
parentf4a45f14cf6902a96d9805ba51829054940ef3e7 (diff)
parent6270f4deba3fbd77d1717fb8634f1fc612ff69e2 (diff)
Merge tag 'hardening-v6.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull hardening fixes from Kees Cook: "Address a KUnit stack initialization regression that got tickled on m68k, and solve a Clang(v14 and earlier) bug found by 0day: - Fix stackinit KUnit regression on m68k - Use ARRAY_SIZE() for memtostr*()/strtomem*()" * tag 'hardening-v6.14-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: string.h: Use ARRAY_SIZE() for memtostr*()/strtomem*() compiler.h: Introduce __must_be_byte_array() compiler.h: Move C string helpers into C-only kernel section stackinit: Fix comment for test_small_end stackinit: Keep selftest union size small on m68k
Diffstat (limited to 'lib/stackinit_kunit.c')
-rw-r--r--lib/stackinit_kunit.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/stackinit_kunit.c b/lib/stackinit_kunit.c
index fbe910c9c8253..135322592faf8 100644
--- a/lib/stackinit_kunit.c
+++ b/lib/stackinit_kunit.c
@@ -75,8 +75,10 @@ static bool stackinit_range_contains(char *haystack_start, size_t haystack_size,
*/
#ifdef CONFIG_M68K
#define FILL_SIZE_STRING 8
+#define FILL_SIZE_ARRAY 2
#else
#define FILL_SIZE_STRING 16
+#define FILL_SIZE_ARRAY 8
#endif
#define INIT_CLONE_SCALAR /**/
@@ -345,11 +347,11 @@ union test_small_start {
short three;
unsigned long four;
struct big_struct {
- unsigned long array[8];
+ unsigned long array[FILL_SIZE_ARRAY];
} big;
};
-/* Mismatched sizes, with one and two being small */
+/* Mismatched sizes, with three and four being small */
union test_small_end {
short one;
unsigned long two;