]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/net: Ensure assert() triggers in psock_tpacket.c
authorWake Liu <wakel@google.com>
Sat, 9 Aug 2025 06:20:13 +0000 (14:20 +0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 12 Aug 2025 03:12:23 +0000 (20:12 -0700)
commitbc4c0a48bdad7f225740b8e750fdc1da6d85e1eb
tree262165dd112b208737008c209c54815d72421b71
parentc36748e8733ef9c5f4cd1d7c4327994e5b88b8df
selftests/net: Ensure assert() triggers in psock_tpacket.c

The get_next_frame() function in psock_tpacket.c was missing a return
statement in its default switch case, leading to a compiler warning.

This was caused by a `bug_on(1)` call, which is defined as an
`assert()`, being compiled out because NDEBUG is defined during the
build.

Instead of adding a `return NULL;` which would silently hide the error
and could lead to crashes later, this change restores the original
author's intent. By adding `#undef NDEBUG` before including <assert.h>,
we ensure the assertion is active and will cause the test to abort if
this unreachable code is ever executed.

Signed-off-by: Wake Liu <wakel@google.com>
Link: https://patch.msgid.link/20250809062013.2407822-1-wakel@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/psock_tpacket.c