Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Wake Liu and committed by
Jakub Kicinski
bc4c0a48 c36748e8

+1
+1
tools/testing/selftests/net/psock_tpacket.c
··· 22 22 * - TPACKET_V3: RX_RING 23 23 */ 24 24 25 + #undef NDEBUG 25 26 #include <stdio.h> 26 27 #include <stdlib.h> 27 28 #include <sys/types.h>