From: Rong Tao Date: Tue, 22 Nov 2022 02:32:56 +0000 (+0800) Subject: samples/bpf: Fix wrong allocation size in xdp_router_ipv4_user X-Git-Tag: v6.6.17~5932^2~120^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=19a2bdbaaddc71405494bd35fa034d9cf582b05e;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/tencent_F9E2E81922B0C181D05B96DAE5AB0ACE6B06@qq.com --- diff --git a/samples/bpf/xdp_router_ipv4_user.c b/samples/bpf/xdp_router_ipv4_user.c index 683913b..9d41db0 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;