netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] selftests/net: Ensure assert() triggers in psock_tpacket.c
@ 2025-08-09  6:20 Wake Liu
  2025-08-12  3:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Wake Liu @ 2025-08-09  6:20 UTC (permalink / raw)
  To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Shuah Khan
  Cc: Simon Horman, netdev, linux-kselftest, linux-kernel, Wake Liu

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>
---
 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 0dd909e325d9..2938045c5cf9 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 <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
-- 
2.50.1.703.g449372360f-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] selftests/net: Ensure assert() triggers in psock_tpacket.c
  2025-08-09  6:20 [PATCH v2] selftests/net: Ensure assert() triggers in psock_tpacket.c Wake Liu
@ 2025-08-12  3:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-12  3:20 UTC (permalink / raw)
  To: Wake Liu
  Cc: davem, edumazet, kuba, pabeni, shuah, horms, netdev,
	linux-kselftest, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat,  9 Aug 2025 14:20:13 +0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [v2] selftests/net: Ensure assert() triggers in psock_tpacket.c
    https://git.kernel.org/netdev/net-next/c/bc4c0a48bdad

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-12  3:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-09  6:20 [PATCH v2] selftests/net: Ensure assert() triggers in psock_tpacket.c Wake Liu
2025-08-12  3:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).