Skip to contentSkip to conversation

bpf: initialise retval in bpf_prog_test_run_xdp()

PATCH Applied Toke Høiland-Jørgensen 2 participants 2 messages Mar 10, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: initialise retval in bpf_prog_test_run_xdp()

The kernel test robot pointed out that the newly added bpf_test_run_xdp_live() runner doesn't set the retval in the caller (by design), which means that the variable can be passed unitialised to bpf_test_finish(). Fix this by initialising the variable properly.

Fixes b530e9e1063e ("bpf: Add "live packet" mode for XDP in BPF_PROG_RUN")
---
 net/bpf/test_run.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bpf/test_run.c +1 -1
index 25169908be4a..0acdc37c8415 100644
@@ -1207,9 +1207,9 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,
 	bool do_live = (kattr->test.flags & BPF_F_TEST_XDP_LIVE_FRAMES);
 	u32 tailroom = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
 	u32 batch_size = kattr->test.batch_size;
+	u32 retval = 0, duration, max_data_sz;
 	u32 size = kattr->test.data_size_in;
 	u32 headroom = XDP_PACKET_HEADROOM;
-	u32 retval, duration, max_data_sz;
 	u32 repeat = kattr->test.repeat;
 	struct netdev_rx_queue *rxqueue;
 	struct skb_shared_info *sinfo;
Signature · 1 line
2.35.1
#1 lore raw
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Quoted 11 lines · On Thu, 10 Mar 2022 12:02:28 +0100 you wrote:

The kernel test robot pointed out that the newly added bpf_test_run_xdp_live() runner doesn't set the retval in the caller (by design), which means that the variable can be passed unitialised to bpf_test_finish(). Fix this by initialising the variable properly.

Fixes b530e9e1063e ("bpf: Add "live packet" mode for XDP in BPF_PROG_RUN")

[...]

Here is the summary with links:
- [bpf-next] bpf: initialise retval in bpf_prog_test_run_xdp()

    https://git.kernel.org/bpf/bpf-next/c/eecbfd976e86

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html