Message ID | 20211209015505.409691-1-chi.minghao@zte.com.cn (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | BPF |
Headers | show |
Series | samples:bpf:remove unneeded variable | expand |
Context | Check | Description |
---|---|---|
bpf/vmtest-bpf-next-PR | pending | PR summary |
bpf/vmtest-bpf-next | pending | VM_Test |
netdev/tree_selection | success | Not a local patch |
On Wed, Dec 8, 2021 at 5:55 PM <cgel.zte@gmail.com> wrote: > > From: chiminghao <chi.minghao@zte.com.cn> > > return value form directly instead of > taking this in another redundant variable. > > Reported-by: Zeal Robot <zealci@zte.com.cm> > Signed-off-by: chiminghao <chi.minghao@zte.com.cn> Signed-off-by should contain properly capitalized full name, please update. Also please use "samples/bpf: " patch prefix and use [PATCH bpf-next] to designate the destination kernel tree. Thanks. > --- > samples/bpf/xdp_redirect_cpu.bpf.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/samples/bpf/xdp_redirect_cpu.bpf.c b/samples/bpf/xdp_redirect_cpu.bpf.c > index f10fe3cf25f6..25e3a405375f 100644 > --- 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 > -- > 2.25.1 >
diff --git a/samples/bpf/xdp_redirect_cpu.bpf.c b/samples/bpf/xdp_redirect_cpu.bpf.c index f10fe3cf25f6..25e3a405375f 100644 --- 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