linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] samples:bpf:remove unneeded variable
@ 2021-12-09  1:55 cgel.zte
  2021-12-09  7:13 ` Andrii Nakryiko
  0 siblings, 1 reply; 5+ messages in thread
From: cgel.zte @ 2021-12-09  1:55 UTC (permalink / raw)
  To: ast
  Cc: daniel, davem, kuba, hawk, john.fastabend, andrii, kafai,
	songliubraving, yhs, kpsingh, netdev, bpf, linux-kernel,
	chiminghao, Zeal Robot

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] samples:bpf:remove unneeded variable
  2021-12-09  1:55 [PATCH] samples:bpf:remove unneeded variable cgel.zte
@ 2021-12-09  7:13 ` Andrii Nakryiko
  2021-12-09  8:00   ` [PATCHv2 bpf-next] samples/bpf:remove " cgel.zte
  0 siblings, 1 reply; 5+ messages in thread
From: Andrii Nakryiko @ 2021-12-09  7:13 UTC (permalink / raw)
  To: cgel.zte
  Cc: Alexei Starovoitov, Daniel Borkmann, David S. Miller,
	Jakub Kicinski, Jesper Dangaard Brouer, john fastabend,
	Andrii Nakryiko, Martin Lau, Song Liu, Yonghong Song, KP Singh,
	Networking, bpf, open list, chiminghao, Zeal Robot

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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCHv2 bpf-next] samples/bpf:remove unneeded variable
  2021-12-09  7:13 ` Andrii Nakryiko
@ 2021-12-09  8:00   ` cgel.zte
  2021-12-09 17:27     ` Andrii Nakryiko
  2021-12-09 17:30     ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: cgel.zte @ 2021-12-09  8:00 UTC (permalink / raw)
  To: andrii.nakryiko
  Cc: andrii, ast, bpf, cgel.zte, chi.minghao, daniel, davem, hawk,
	john.fastabend, kafai, kpsingh, kuba, linux-kernel, netdev,
	songliubraving, yhs, zealci

From: Minghao Chi <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: Minghao Chi <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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCHv2 bpf-next] samples/bpf:remove unneeded variable
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Andrii Nakryiko @ 2021-12-09 17:27 UTC (permalink / raw)
  To: cgel.zte
  Cc: Andrii Nakryiko, Alexei Starovoitov, bpf, chiminghao,
	Daniel Borkmann, David S. Miller, Jesper Dangaard Brouer,
	john fastabend, Martin Lau, KP Singh, Jakub Kicinski, open list,
	Networking, Song Liu, Yonghong Song, Zeal Robot

On Thu, Dec 9, 2021 at 12:01 AM <cgel.zte@gmail.com> wrote:
>
> From: Minghao Chi <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: Minghao Chi <chi.minghao@zte.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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCHv2 bpf-next] samples/bpf:remove unneeded variable
  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
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-09 17:30 UTC (permalink / raw)
  To: CGEL
  Cc: andrii.nakryiko, andrii, ast, bpf, chi.minghao, daniel, davem,
	hawk, john.fastabend, kafai, kpsingh, kuba, linux-kernel, netdev,
	songliubraving, yhs, zealci

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Thu,  9 Dec 2021 08:00:51 +0000 you wrote:
> From: Minghao Chi <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: Minghao Chi <chi.minghao@zte.com.cn>
> 
> [...]

Here is the summary with links:
  - [PATCHv2,bpf-next] samples/bpf:remove unneeded variable
    https://git.kernel.org/bpf/bpf-next/c/ac55b3f00c32

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-09 17:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-09  1:55 [PATCH] samples:bpf:remove unneeded variable cgel.zte
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).