BPF List
 help / color / mirror / Atom feed
From: Kui-Feng Lee <sinquersw@gmail.com>
To: Martin KaFai Lau <martin.lau@linux.dev>, thinker.li@gmail.com
Cc: kuifeng@meta.com, bpf@vger.kernel.org, ast@kernel.org,
	song@kernel.org, kernel-team@meta.com, andrii@kernel.org,
	davemarchevsky@meta.com, dvernet@meta.com
Subject: Re: [RFC bpf-next v4 3/6] bpf: Remove an unnecessary check.
Date: Fri, 2 Feb 2024 17:03:32 -0800	[thread overview]
Message-ID: <25428377-88f9-4f54-a042-44911bf1a77b@gmail.com> (raw)
In-Reply-To: <4a63f6cd-2b0b-4a2b-827b-75bee67b8757@linux.dev>



On 2/2/24 16:46, Martin KaFai Lau wrote:
> On 2/2/24 2:05 PM, thinker.li@gmail.com wrote:
>> From: Kui-Feng Lee <thinker.li@gmail.com>
>>
>> The "i" here is always equal to "btf_type_vlen(t)" since
>> the "for_each_member()" loop never breaks.
> 
> It can be separated from the PTR_MAYBE_NULL support set. Please post 
> this as its own patch without the RFC.

Sure!

>> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
>> ---
>>   kernel/bpf/bpf_struct_ops.c | 21 +++++++++------------
>>   1 file changed, 9 insertions(+), 12 deletions(-)
>>
>> diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c
>> index 0decd862dfe0..f98f580de77a 100644
>> --- a/kernel/bpf/bpf_struct_ops.c
>> +++ b/kernel/bpf/bpf_struct_ops.c
>> @@ -189,20 +189,17 @@ int bpf_struct_ops_desc_init(struct 
>> bpf_struct_ops_desc *st_ops_desc,
>>           }
>>       }
>> -    if (i == btf_type_vlen(t)) {
>> -        if (st_ops->init(btf)) {
>> -            pr_warn("Error in init bpf_struct_ops %s\n",
>> -                st_ops->name);
>> -            return -EINVAL;
>> -        } else {
>> -            st_ops_desc->type_id = type_id;
>> -            st_ops_desc->type = t;
>> -            st_ops_desc->value_id = value_id;
>> -            st_ops_desc->value_type = btf_type_by_id(btf,
>> -                                 value_id);
>> -        }
>> +    if (st_ops->init(btf)) {
>> +        pr_warn("Error in init bpf_struct_ops %s\n",
>> +            st_ops->name);
>> +        return -EINVAL;
>>       }
>> +    st_ops_desc->type_id = type_id;
>> +    st_ops_desc->type = t;
>> +    st_ops_desc->value_id = value_id;
>> +    st_ops_desc->value_type = btf_type_by_id(btf, value_id);
>> +
>>       return 0;
>>   }
> 

  reply	other threads:[~2024-02-03  1:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 22:05 [RFC bpf-next v4 0/6] Support PTR_MAYBE_NULL for struct_ops arguments thinker.li
2024-02-02 22:05 ` [RFC bpf-next v4 1/6] bpf: Allow PTR_TO_BTF_ID even for pointers to int thinker.li
2024-02-02 22:05 ` [RFC bpf-next v4 2/6] bpf: Extend PTR_TO_BTF_ID to handle pointers to scalar and array types thinker.li
2024-02-03  0:52   ` Martin KaFai Lau
2024-02-03  1:03     ` Kui-Feng Lee
2024-02-02 22:05 ` [RFC bpf-next v4 3/6] bpf: Remove an unnecessary check thinker.li
2024-02-03  0:46   ` Martin KaFai Lau
2024-02-03  1:03     ` Kui-Feng Lee [this message]
2024-02-02 22:05 ` [RFC bpf-next v4 4/6] bpf: add btf pointer to struct bpf_ctx_arg_aux thinker.li
2024-02-02 22:05 ` [RFC bpf-next v4 5/6] bpf: Create argument information for nullable arguments thinker.li
2024-02-03  0:40   ` Martin KaFai Lau
2024-02-03  1:57     ` Kui-Feng Lee
2024-02-04  0:21       ` Kui-Feng Lee
2024-02-05  1:53     ` Kui-Feng Lee
2024-02-02 22:05 ` [RFC bpf-next v4 6/6] selftests/bpf: Test PTR_MAYBE_NULL arguments of struct_ops operators thinker.li

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=25428377-88f9-4f54-a042-44911bf1a77b@gmail.com \
    --to=sinquersw@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=davemarchevsky@meta.com \
    --cc=dvernet@meta.com \
    --cc=kernel-team@meta.com \
    --cc=kuifeng@meta.com \
    --cc=martin.lau@linux.dev \
    --cc=song@kernel.org \
    --cc=thinker.li@gmail.com \
    /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