Re: [PATCH bpf-next 03/15] bpf: Refactor btf_check_func_arg_match

2021-03-20 Thread Andrii Nakryiko
On Fri, Mar 19, 2021 at 5:10 PM Alexei Starovoitov wrote: > > On 3/19/21 2:51 PM, Andrii Nakryiko wrote: > > > > It's a matter of taste, I suppose. I'd probably disagree with you on > > the readability of those verifier parts ;) So it's up to you, of > > course, but for me this code pattern: > > >

Re: [PATCH bpf-next 03/15] bpf: Refactor btf_check_func_arg_match

2021-03-19 Thread Alexei Starovoitov
On 3/19/21 2:51 PM, Andrii Nakryiko wrote: It's a matter of taste, I suppose. I'd probably disagree with you on the readability of those verifier parts ;) So it's up to you, of course, but for me this code pattern: for (...) { if (A) { handleA; } else if (B) { handle

Re: [PATCH bpf-next 03/15] bpf: Refactor btf_check_func_arg_match

2021-03-19 Thread Andrii Nakryiko
On Fri, Mar 19, 2021 at 12:32 PM Martin KaFai Lau wrote: > > On Thu, Mar 18, 2021 at 04:32:47PM -0700, Andrii Nakryiko wrote: > > On Tue, Mar 16, 2021 at 12:01 AM Martin KaFai Lau wrote: > > > > > > This patch refactors the core logic of "btf_check_func_arg_match()" > > > into a new function "do_

Re: [PATCH bpf-next 03/15] bpf: Refactor btf_check_func_arg_match

2021-03-19 Thread Martin KaFai Lau
On Thu, Mar 18, 2021 at 04:32:47PM -0700, Andrii Nakryiko wrote: > On Tue, Mar 16, 2021 at 12:01 AM Martin KaFai Lau wrote: > > > > This patch refactors the core logic of "btf_check_func_arg_match()" > > into a new function "do_btf_check_func_arg_match()". > > "do_btf_check_func_arg_match()" will

Re: [PATCH bpf-next 03/15] bpf: Refactor btf_check_func_arg_match

2021-03-18 Thread Andrii Nakryiko
On Tue, Mar 16, 2021 at 12:01 AM Martin KaFai Lau wrote: > > This patch refactors the core logic of "btf_check_func_arg_match()" > into a new function "do_btf_check_func_arg_match()". > "do_btf_check_func_arg_match()" will be reused later to check > the kernel function call. > > The "if (!btf_type

[PATCH bpf-next 03/15] bpf: Refactor btf_check_func_arg_match

2021-03-15 Thread Martin KaFai Lau
This patch refactors the core logic of "btf_check_func_arg_match()" into a new function "do_btf_check_func_arg_match()". "do_btf_check_func_arg_match()" will be reused later to check the kernel function call. The "if (!btf_type_is_ptr(t))" is checked first to improve the indentation which will be