]> git.baikalelectronics.ru Git - kernel.git/commit
samples/bpf: Fix incorrect use of strlen in xdp_redirect_cpu
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Fri, 12 Nov 2021 02:03:01 +0000 (07:33 +0530)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 13 Nov 2021 01:23:16 +0000 (17:23 -0800)
commitdf3b82ab786fe8861bea62eab0676fbe412635e7
tree5837fe04c96aba74acee37ec4ff6c923c14b1576
parent375fabf44255c23449a4c9a4f6260c9449165d95
samples/bpf: Fix incorrect use of strlen in xdp_redirect_cpu

Commit 6cf2b2683da3 ("samples/bpf: Fix application of sizeof to pointer")
tried to fix a bug where sizeof was incorrectly applied to a pointer instead
of the array string was being copied to, to find the destination buffer size,
but ended up using strlen, which is still incorrect. However, on closer look
ifname_buf has no other use, hence directly use optarg.

Fixes: 6cf2b2683da3 ("samples/bpf: Fix application of sizeof to pointer")
Fixes: 7c86866d8636 ("samples: bpf: Convert xdp_redirect_cpu to XDP samples helper")
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Tested-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Link: https://lore.kernel.org/bpf/20211112020301.528357-1-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
samples/bpf/xdp_redirect_cpu_user.c