aboutsummaryrefslogtreecommitdiffstats
path: root/samples/bpf/xdp_router_ipv4_user.c
diff options
context:
space:
mode:
authorRong Tao <[email protected]>2022-11-22 02:32:56 +0000
committerDaniel Borkmann <[email protected]>2022-11-24 23:21:29 +0000
commit19a2bdbaaddc71405494bd35fa034d9cf582b05e (patch)
tree6289803908f759c1fbd96dace44a5e6902027e11 /samples/bpf/xdp_router_ipv4_user.c
parentdocs/bpf: Update btf selftests program and add link (diff)
downloadkernel-19a2bdbaaddc71405494bd35fa034d9cf582b05e.tar.gz
kernel-19a2bdbaaddc71405494bd35fa034d9cf582b05e.zip
samples/bpf: Fix wrong allocation size in xdp_router_ipv4_user
prefix_key->data allocates three bytes using alloca(), but four bytes are actually accessed in the program. Signed-off-by: Rong Tao <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'samples/bpf/xdp_router_ipv4_user.c')
-rw-r--r--samples/bpf/xdp_router_ipv4_user.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/samples/bpf/xdp_router_ipv4_user.c b/samples/bpf/xdp_router_ipv4_user.c
index 683913bbf279..9d41db09c480 100644
--- a/samples/bpf/xdp_router_ipv4_user.c
+++ b/samples/bpf/xdp_router_ipv4_user.c
@@ -162,7 +162,7 @@ static void read_route(struct nlmsghdr *nh, int nll)
__be32 gw;
} *prefix_value;
- prefix_key = alloca(sizeof(*prefix_key) + 3);
+ prefix_key = alloca(sizeof(*prefix_key) + 4);
prefix_value = alloca(sizeof(*prefix_value));
prefix_key->prefixlen = 32;