diff options
author | Ingo Molnar <mingo@kernel.org> | 2024-04-03 09:53:40 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2024-04-03 09:57:26 +0300 |
commit | 6a2bcf9277dcbdef88d514113434b45f8ffc5469 (patch) | |
tree | af426cf4a48d857dc0dc84d4ba88d059e5f16611 /lib/overflow_kunit.c | |
parent | b90169b42a6f49ff2fe2e4d4ed0bbcf17fb8f1bf (diff) | |
parent | 39cd87c4eb2b893354f3b850f916353f2658ae6f (diff) | |
download | linux-6a2bcf9277dcbdef88d514113434b45f8ffc5469.tar.xz |
Merge tag 'v6.9-rc2' into x86/percpu, to pick up fixes and resolve conflict
Conflicts:
arch/x86/Kconfig
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'lib/overflow_kunit.c')
-rw-r--r-- | lib/overflow_kunit.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/overflow_kunit.c b/lib/overflow_kunit.c index 65e8a72a83bf..4ef31b0bb74d 100644 --- a/lib/overflow_kunit.c +++ b/lib/overflow_kunit.c @@ -1172,6 +1172,24 @@ static void castable_to_type_test(struct kunit *test) #undef TEST_CASTABLE_TO_TYPE } +struct foo { + int a; + u32 counter; + s16 array[] __counted_by(counter); +}; + +static void DEFINE_FLEX_test(struct kunit *test) +{ + DEFINE_RAW_FLEX(struct foo, two, array, 2); + DEFINE_FLEX(struct foo, eight, array, counter, 8); + DEFINE_FLEX(struct foo, empty, array, counter, 0); + + KUNIT_EXPECT_EQ(test, __struct_size(two), + sizeof(struct foo) + sizeof(s16) + sizeof(s16)); + KUNIT_EXPECT_EQ(test, __struct_size(eight), 24); + KUNIT_EXPECT_EQ(test, __struct_size(empty), sizeof(struct foo)); +} + static struct kunit_case overflow_test_cases[] = { KUNIT_CASE(u8_u8__u8_overflow_test), KUNIT_CASE(s8_s8__s8_overflow_test), @@ -1194,6 +1212,7 @@ static struct kunit_case overflow_test_cases[] = { KUNIT_CASE(overflows_type_test), KUNIT_CASE(same_type_test), KUNIT_CASE(castable_to_type_test), + KUNIT_CASE(DEFINE_FLEX_test), {} }; |