]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:48:48 +0000 (09:48 +0100)
commitbe763f76203af6f7a17662e2c3b4e40f2233b8d8
tree3bad462d1ea0ced356bd0cae416e8ac047e80b00
parent7a8611397275a257d6b8cd78a6683bbd36277d73
samples/bpf: Fix incorrect use of strlen in xdp_redirect_cpu

BugLink: https://bugs.launchpad.net/bugs/1952579
[ Upstream commit 2453afe3845523d9dfe89dbfb3d71abfa095e260 ]

Commit b599015f044d ("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: b599015f044d ("samples/bpf: Fix application of sizeof to pointer")
Fixes: e531a220cc59 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
samples/bpf/xdp_redirect_cpu_user.c