提交 ac55b3f0 编写于 作者: M Minghao Chi 提交者: Andrii Nakryiko

samples/bpf: Remove unneeded variable

Return value directly instead of taking this in another redundant variable.
Reported-by: NZeal Robot <zealci@zte.com.cm>
Signed-off-by: NMinghao Chi <chi.minghao@zte.com.cn>
Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211209080051.421844-1-chi.minghao@zte.com.cn
上级 73b6eae5
...@@ -100,7 +100,6 @@ u16 get_dest_port_ipv4_udp(struct xdp_md *ctx, u64 nh_off) ...@@ -100,7 +100,6 @@ u16 get_dest_port_ipv4_udp(struct xdp_md *ctx, u64 nh_off)
void *data = (void *)(long)ctx->data; void *data = (void *)(long)ctx->data;
struct iphdr *iph = data + nh_off; struct iphdr *iph = data + nh_off;
struct udphdr *udph; struct udphdr *udph;
u16 dport;
if (iph + 1 > data_end) if (iph + 1 > data_end)
return 0; return 0;
...@@ -111,8 +110,7 @@ u16 get_dest_port_ipv4_udp(struct xdp_md *ctx, u64 nh_off) ...@@ -111,8 +110,7 @@ u16 get_dest_port_ipv4_udp(struct xdp_md *ctx, u64 nh_off)
if (udph + 1 > data_end) if (udph + 1 > data_end)
return 0; return 0;
dport = bpf_ntohs(udph->dest); return bpf_ntohs(udph->dest);
return dport;
} }
static __always_inline static __always_inline
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册