mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 22:37:45 -04:00
samples/bpf: Fix application of sizeof to pointer
The coccinelle check report: "./samples/bpf/xdp_redirect_cpu_user.c:397:32-38: ERROR: application of sizeof to pointer" Using the "strlen" to fix it. Reported-by: Zeal Robot <[email protected]> Signed-off-by: David Yang <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
This commit is contained in:
1 parent
efc36d6c64
commit
b599015f04
1 file changed
+2
-4
@@ -325,7 +325,6 @@ int main(int argc, char **argv)
|
||||
int add_cpu = -1;
|
||||
int ifindex = -1;
|
||||
int *cpu, i, opt;
|
||||
char *ifname;
|
||||
__u32 qsize;
|
||||
int n_cpus;
|
||||
|
||||
@@ -393,9 +392,8 @@ int main(int argc, char **argv)
|
||||
fprintf(stderr, "-d/--dev name too long\n");
|
||||
goto end_cpu;
|
||||
}
|
||||
ifname = (char *)&ifname_buf;
|
||||
safe_strncpy(ifname, optarg, sizeof(ifname));
|
||||
ifindex = if_nametoindex(ifname);
|
||||
safe_strncpy(ifname_buf, optarg, strlen(ifname_buf));
|
||||
ifindex = if_nametoindex(ifname_buf);
|
||||
if (!ifindex)
|
||||
ifindex = strtoul(optarg, NULL, 0);
|
||||
if (!ifindex) {
|
||||
|
||||
Reference in new issue
Block a user