From: cgel.zte@gmail.com
To: ast@kernel.org
Cc: daniel@iogearbox.net, davem@davemloft.net, kuba@kernel.org,
hawk@kernel.org, john.fastabend@gmail.com, andrii@kernel.org,
kafai@fb.com, songliubraving@fb.com, yhs@fb.com,
kpsingh@kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org, chiminghao <chi.minghao@zte.com.cn>,
Zeal Robot <zealci@zte.com.cm>
Subject: [PATCH] samples:bpf:remove unneeded variable
Date: Thu, 9 Dec 2021 01:55:05 +0000 [thread overview]
Message-ID: <20211209015505.409691-1-chi.minghao@zte.com.cn> (raw)
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>
---
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
next reply other threads:[~2021-12-09 1:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-09 1:55 cgel.zte [this message]
2021-12-09 7:13 ` Andrii Nakryiko
2021-12-09 8:00 ` [PATCHv2 bpf-next] samples/bpf:remove " cgel.zte
2021-12-09 17:27 ` Andrii Nakryiko
2021-12-09 17:30 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211209015505.409691-1-chi.minghao@zte.com.cn \
--to=cgel.zte@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chi.minghao@zte.com.cn \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
--cc=zealci@zte.com.cm \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®