mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>
To: Feng Yang <yangfeng59949@163.com>,
	ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
	yonghong.song@linux.dev, john.fastabend@gmail.com,
	kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com,
	jolsa@kernel.org
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next] bpf: Add the missing types in the logs
Date: Wed, 28 Jan 2026 14:10:24 +0000	[thread overview]
Message-ID: <750db7bc-2cc5-4a53-8bb6-30e702fa0989@gmail.com> (raw)
In-Reply-To: <20260128085842.145057-1-yangfeng59949@163.com>

On 1/28/26 08:58, Feng Yang wrote:
> From: Feng Yang <yangfeng@kylinos.cn>
>
> Add the missing types to avoid such uninformative errors as shown below:
> R1 type=ptr_ expected=ptr_
>
> Signed-off-by: Feng Yang <yangfeng@kylinos.cn>
> ---
>   kernel/bpf/log.c | 16 ++++++++++++++--
>   1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/bpf/log.c b/kernel/bpf/log.c
> index a0c3b35de2ce..6fee3d8b3703 100644
> --- a/kernel/bpf/log.c
> +++ b/kernel/bpf/log.c
> @@ -473,14 +473,26 @@ const char *reg_type_str(struct bpf_verifier_env *env, enum bpf_reg_type type)
>   			strscpy(postfix, "_or_null");
>   	}
>   
> -	snprintf(prefix, sizeof(prefix), "%s%s%s%s%s%s%s",
> +	snprintf(prefix, sizeof(prefix), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
>   		 type & MEM_RDONLY ? "rdonly_" : "",
>   		 type & MEM_RINGBUF ? "ringbuf_" : "",
>   		 type & MEM_USER ? "user_" : "",
>   		 type & MEM_PERCPU ? "percpu_" : "",
>   		 type & MEM_RCU ? "rcu_" : "",
>   		 type & PTR_UNTRUSTED ? "untrusted_" : "",
> -		 type & PTR_TRUSTED ? "trusted_" : ""
> +		 type & PTR_TRUSTED ? "trusted_" : "",
> +		 type & MEM_UNINIT ? "uninit_" : "",
> +		 type & DYNPTR_TYPE_LOCAL ? "dynptr_local_" : "",
> +		 type & DYNPTR_TYPE_RINGBUF ? "dynptr_ringbuf_" : "",
> +		 type & MEM_FIXED_SIZE ? "fixed_size_" : "",
> +		 type & MEM_ALLOC ? "alloc_" : "",
> +		 type & NON_OWN_REF ? "non_own_ref_" : "",
> +		 type & DYNPTR_TYPE_SKB ? "dynptr_skb_" : "",
> +		 type & DYNPTR_TYPE_XDP ? "dynptr_xdp_" : "",
> +		 type & MEM_ALIGNED ? "aligned_" : "",
> +		 type & MEM_WRITE ? "write_" : "",
> +		 type & DYNPTR_TYPE_SKB_META ? "dynptr_skb_meta_" : "",
> +		 type & DYNPTR_TYPE_FILE ? "dynptr_file_" : ""
>   	);
Maybe it'll be good to decrease the number of the %s
and also group up the strings, for example:
const char *dynptr_reg_type(...)
{
     if (type & DYNPTR_TYPE_SKB) return "dynptr_skb_"; if (type & 
DYNPTR_TYPE_XDP) return "dynptr_xdp_";} so later we can substitute 
multiple %s with just one, corresponding to the dynptr type, this also 
ensures dynptr type is always in the same place, relative to other 
things. This can also be applied to (MEM_RDONLY, MEM_WRITE), 
(PTR_TRUSTED, PTR_UNTRUSTED) and so on.
>   
>   	snprintf(env->tmp_str_buf, TMP_STR_BUF_LEN, "%s%s%s",


  reply	other threads:[~2026-01-28 14:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28  8:58 Feng Yang
2026-01-28 14:10 ` Mykyta Yatsenko [this message]
2026-01-28 14:45 ` kernel test robot
2026-01-28 15:26 ` kernel test robot

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=750db7bc-2cc5-4a53-8bb6-30e702fa0989@gmail.com \
    --to=mykyta.yatsenko5@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yangfeng59949@163.com \
    --cc=yonghong.song@linux.dev \
    /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®