Skip to content

Commit eecbfd9

Browse files
tohojoborkmann
authored andcommitted
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: b530e9e ("bpf: Add "live packet" mode for XDP in BPF_PROG_RUN") Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Toke Høiland-Jørgensen <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent f655c08 commit eecbfd9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/bpf/test_run.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,9 +1207,9 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,
12071207
bool do_live = (kattr->test.flags & BPF_F_TEST_XDP_LIVE_FRAMES);
12081208
u32 tailroom = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
12091209
u32 batch_size = kattr->test.batch_size;
1210+
u32 retval = 0, duration, max_data_sz;
12101211
u32 size = kattr->test.data_size_in;
12111212
u32 headroom = XDP_PACKET_HEADROOM;
1212-
u32 retval, duration, max_data_sz;
12131213
u32 repeat = kattr->test.repeat;
12141214
struct netdev_rx_queue *rxqueue;
12151215
struct skb_shared_info *sinfo;

0 commit comments

Comments
 (0)