From fd1a470de3cba3af857cca7ffd519951dedba074 Mon Sep 17 00:00:00 2001 From: Wake Liu Date: Thu, 24 Jul 2025 16:52:52 +0800 Subject: [PATCH] ANDROID: 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 , we ensure the assertion is active and will cause the test to abort if this unreachable code is ever executed. Bug: 422759683 Test: atest -a vts_linux_kselftest_x86_64 Link: https://lore.kernel.org/all/20250809062013.2407822-1-wakel@google.com/ Change-Id: Iccf4b39087c0c4d137cbefa94f610dd1ed71e205 Signed-off-by: Wake Liu --- tools/testing/selftests/net/psock_tpacket.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/net/psock_tpacket.c b/tools/testing/selftests/net/psock_tpacket.c index 0dd909e325d93..2938045c5cf97 100644 --- a/tools/testing/selftests/net/psock_tpacket.c +++ b/tools/testing/selftests/net/psock_tpacket.c @@ -22,6 +22,7 @@ * - TPACKET_V3: RX_RING */ +#undef NDEBUG #include #include #include -- 2.50.1.703.g449372360f-goog