Commit ac55b3f0 authored by Minghao Chi's avatar Minghao Chi Committed by Andrii Nakryiko
Browse files

samples/bpf: Remove unneeded variable



Return value directly instead of taking this in another redundant variable.

Reported-by: default avatarZeal Robot <zealci@zte.com.cm>
Signed-off-by: default avatarMinghao Chi <chi.minghao@zte.com.cn>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211209080051.421844-1-chi.minghao@zte.com.cn
parent 73b6eae5
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -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)
	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