projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
73b6eae
)
samples/bpf: Remove unneeded variable
author
Minghao Chi
<chi.minghao@zte.com.cn>
Thu, 9 Dec 2021 08:00:51 +0000
(08:00 +0000)
committer
Andrii Nakryiko
<andrii@kernel.org>
Thu, 9 Dec 2021 17:21:45 +0000
(09:21 -0800)
Return value directly instead of taking this in another redundant variable.
Reported-by: Zeal Robot <zealci@zte.com.cm>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link:
https://lore.kernel.org/bpf/20211209080051.421844-1-chi.minghao@zte.com.cn
samples/bpf/xdp_redirect_cpu.bpf.c
patch
|
blob
|
history
diff --git
a/samples/bpf/xdp_redirect_cpu.bpf.c
b/samples/bpf/xdp_redirect_cpu.bpf.c
index
f10fe3c
..
25e3a40
100644
(file)
--- a/
samples/bpf/xdp_redirect_cpu.bpf.c
+++ b/
samples/bpf/xdp_redirect_cpu.bpf.c
@@
-100,7
+100,6
@@
u16 get_dest_port_ipv4_udp(struct xdp_md *ctx, u64 nh_off)
void *data = (void *)(long)ctx->data;
struct iphdr *iph = data + nh_off;
struct udphdr *udph;
- u16 dport;
if (iph + 1 > data_end)
return 0;
@@
-111,8
+110,7
@@
u16 get_dest_port_ipv4_udp(struct xdp_md *ctx, u64 nh_off)
if (udph + 1 > data_end)
return 0;
- dport = bpf_ntohs(udph->dest);
- return dport;
+ return bpf_ntohs(udph->dest);
}
static __always_inline