[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzbuQzP52M6sQVic36ehmL2JO52jz08GA8swdSazF7=umg@mail.gmail.com>
Date: Thu, 9 Dec 2021 09:27:32 -0800
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: cgel.zte@...il.com
Cc: Andrii Nakryiko <andrii@...nel.org>,
Alexei Starovoitov <ast@...nel.org>, bpf <bpf@...r.kernel.org>,
chiminghao <chi.minghao@....com.cn>,
Daniel Borkmann <daniel@...earbox.net>,
"David S. Miller" <davem@...emloft.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
john fastabend <john.fastabend@...il.com>,
Martin Lau <kafai@...com>, KP Singh <kpsingh@...nel.org>,
Jakub Kicinski <kuba@...nel.org>,
open list <linux-kernel@...r.kernel.org>,
Networking <netdev@...r.kernel.org>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Zeal Robot <zealci@....com.cm>
Subject: Re: [PATCHv2 bpf-next] samples/bpf:remove unneeded variable
On Thu, Dec 9, 2021 at 12:01 AM <cgel.zte@...il.com> wrote:
>
> From: Minghao Chi <chi.minghao@....com.cn>
>
> return value form directly instead of
> taking this in another redundant variable.
>
> Reported-by: Zeal Robot <zealci@....com.cm>
> Signed-off-by: Minghao Chi <chi.minghao@....com.cn>
> ---
Applied to bpf-next, 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
>
Powered by blists - more mailing lists