mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
samples/bpf: Remove unneeded variable
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
This commit is contained in:
parent
73b6eae583
commit
ac55b3f00c
1 changed files with 1 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue