linux-yocto/lib/tests
Kees Cook 04e403e662 kunit/overflow: Fix DEFINE_FLEX tests for counted_by
Unfortunately, __builtin_dynamic_object_size() does not take into account
flexible array sizes, even when they are sized by __counted_by. As a
result, the size tests for the flexible arrays need to be separated to
get an accurate check of the compiler's behavior. While at it, fully test
sizeof, __struct_size (bdos(..., 0)), and __member_size (bdos(..., 1)).

I still think this is a compiler design issue, but there's not much to
be done about it currently beyond adjusting these tests. GCC and Clang
agree on this behavior at least. :)

Reported-by: "Thomas Weißschuh" <linux@weissschuh.net>
Closes: https://lore.kernel.org/lkml/e1a1531d-6968-4ae8-a3b5-5ea0547ec4b3@t-8ch.de/
Fixes: 9dd5134c61 ("kunit/overflow: Adjust for __counted_by with DEFINE_RAW_FLEX()")
Signed-off-by: Kees Cook <kees@kernel.org>
2025-03-04 19:31:35 -08:00
..
module selftests: kallsyms: fix and clarify current test boundaries 2024-11-28 11:17:30 -08:00
bitfield_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
checksum_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
cmdline_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
cpumask_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
crc_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
fortify_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
hashtable_test.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
is_signed_type_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
kfifo_kunit.c lib/tests/kfifo_kunit.c: add tests for the kfifo structure 2025-02-10 18:25:39 -08:00
kunit_iov_iter.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
list-test.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
Makefile lib/tests/kfifo_kunit.c: add tests for the kfifo structure 2025-02-10 18:25:39 -08:00
memcpy_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
overflow_kunit.c kunit/overflow: Fix DEFINE_FLEX tests for counted_by 2025-03-04 19:31:35 -08:00
siphash_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
slub_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
stackinit_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
string_helpers_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
string_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
test_bits.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
test_fprobe.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
test_hash.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
test_kprobes.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
test_linear_ranges.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
test_list_sort.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
test_sort.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
usercopy_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00
util_macros_kunit.c lib: Move KUnit tests into tests/ subdirectory 2025-02-10 18:25:39 -08:00