netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: use BPF_CAST_CALL for casting bpf call
@ 2019-04-16  9:13 Prashant Bhole
  2019-04-16 20:28 ` Song Liu
  2019-04-17  2:30 ` Alexei Starovoitov
  0 siblings, 2 replies; 3+ messages in thread
From: Prashant Bhole @ 2019-04-16  9:13 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann
  Cc: Prashant Bhole, Martin KaFai Lau, Song Liu, Yonghong Song,
	prashantbhole.linux, netdev

verifier.c uses BPF_CAST_CALL for casting bpf call except at one
place in jit_subprogs(). Let's use the macro for consistency.

Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
---
 kernel/bpf/verifier.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index c7220153c5b1..db301e9b5295 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -7647,9 +7647,8 @@ static int jit_subprogs(struct bpf_verifier_env *env)
 			    insn->src_reg != BPF_PSEUDO_CALL)
 				continue;
 			subprog = insn->off;
-			insn->imm = (u64 (*)(u64, u64, u64, u64, u64))
-				func[subprog]->bpf_func -
-				__bpf_call_base;
+			insn->imm = BPF_CAST_CALL(func[subprog]->bpf_func) -
+				    __bpf_call_base;
 		}
 
 		/* we use the aux data to keep a list of the start addresses
-- 
2.17.2



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

* Re: [PATCH bpf-next] bpf: use BPF_CAST_CALL for casting bpf call
  2019-04-16  9:13 [PATCH bpf-next] bpf: use BPF_CAST_CALL for casting bpf call Prashant Bhole
@ 2019-04-16 20:28 ` Song Liu
  2019-04-17  2:30 ` Alexei Starovoitov
  1 sibling, 0 replies; 3+ messages in thread
From: Song Liu @ 2019-04-16 20:28 UTC (permalink / raw)
  To: Prashant Bhole
  Cc: Alexei Starovoitov, Daniel Borkmann, Martin Lau, Yonghong Song,
	prashantbhole.linux, netdev



> On Apr 16, 2019, at 2:13 AM, Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp> wrote:
> 
> verifier.c uses BPF_CAST_CALL for casting bpf call except at one
> place in jit_subprogs(). Let's use the macro for consistency.
> 
> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>

Acked-by: Song Liu <songliubraving@fb.com>

> ---
> kernel/bpf/verifier.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index c7220153c5b1..db301e9b5295 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -7647,9 +7647,8 @@ static int jit_subprogs(struct bpf_verifier_env *env)
> 			    insn->src_reg != BPF_PSEUDO_CALL)
> 				continue;
> 			subprog = insn->off;
> -			insn->imm = (u64 (*)(u64, u64, u64, u64, u64))
> -				func[subprog]->bpf_func -
> -				__bpf_call_base;
> +			insn->imm = BPF_CAST_CALL(func[subprog]->bpf_func) -
> +				    __bpf_call_base;
> 		}
> 
> 		/* we use the aux data to keep a list of the start addresses
> -- 
> 2.17.2
> 
> 


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

* Re: [PATCH bpf-next] bpf: use BPF_CAST_CALL for casting bpf call
  2019-04-16  9:13 [PATCH bpf-next] bpf: use BPF_CAST_CALL for casting bpf call Prashant Bhole
  2019-04-16 20:28 ` Song Liu
@ 2019-04-17  2:30 ` Alexei Starovoitov
  1 sibling, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2019-04-17  2:30 UTC (permalink / raw)
  To: Prashant Bhole
  Cc: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, prashantbhole.linux, Network Development

On Tue, Apr 16, 2019 at 2:13 AM Prashant Bhole
<bhole_prashant_q7@lab.ntt.co.jp> wrote:
>
> verifier.c uses BPF_CAST_CALL for casting bpf call except at one
> place in jit_subprogs(). Let's use the macro for consistency.
>
> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>

Applied. Thanks

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

end of thread, other threads:[~2019-04-17  2:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16  9:13 [PATCH bpf-next] bpf: use BPF_CAST_CALL for casting bpf call Prashant Bhole
2019-04-16 20:28 ` Song Liu
2019-04-17  2:30 ` Alexei Starovoitov

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).