All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [kkdwivedi:typed-arena 8/17] kernel/bpf/log.c:435:59: warning: '%s' directive output may be truncated writing up to 12 bytes into a region of size between 3 and 64
Date: Tue, 29 Sep 2026 04:21:26 +0800	[thread overview]
Message-ID: <202609290429.usknjcji-lkp@intel.com> (raw)

tree:   https://github.com/kkdwivedi/linux typed-arena
head:   f6fd10fe616e1927b9c398a528edc49c6593c06a
commit: 51aabdea74c4d256db3227960617f361a660436f [8/17] bpf: Trust typed pointer fields of typed arena objects
config: csky-randconfig-1000-20260928 (https://download.01.org/0day-ci/archive/20260929/202609290429.usknjcji-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260929/202609290429.usknjcji-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609290429.usknjcji-lkp@intel.com/

All warnings (new ones prefixed by >>):

   kernel/bpf/log.c: In function 'reg_type_str':
>> kernel/bpf/log.c:435:59: warning: '%s' directive output may be truncated writing up to 12 bytes into a region of size between 3 and 64 [-Wformat-truncation=]
     435 |         snprintf(prefix, sizeof(prefix), "%s%s%s%s%s%s%s%s%s",
         |                                                           ^~
   kernel/bpf/log.c:435:9: note: 'snprintf' output between 1 and 74 bytes into a destination of size 64
     435 |         snprintf(prefix, sizeof(prefix), "%s%s%s%s%s%s%s%s%s",
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     436 |                  type & MEM_RDONLY ? "rdonly_" : "",
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     437 |                  type & MEM_RINGBUF ? "ringbuf_" : "",
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     438 |                  type & MEM_USER ? "user_" : "",
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     439 |                  type & MEM_PERCPU ? "percpu_" : "",
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     440 |                  type & MEM_RCU ? "rcu_" : "",
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     441 |                  type & PTR_UNTRUSTED ? "untrusted_" : "",
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     442 |                  type & PTR_TRUSTED ? "trusted_" : "",
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     443 |                  type & PTR_UNSANITIZED ? "unsanitized_" : "",
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     444 |                  type & MEM_ARENA ? "typed_arena_" : ""
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     445 |         );
         |         ~


vim +435 kernel/bpf/log.c

   393	
   394	/* string representation of 'enum bpf_reg_type'
   395	 *
   396	 * Note that reg_type_str() can not appear more than once in a single verbose()
   397	 * statement.
   398	 */
   399	const char *reg_type_str(struct bpf_verifier_env *env, enum bpf_reg_type type)
   400	{
   401		char postfix[16] = {0}, prefix[64] = {0};
   402		static const char * const str[] = {
   403			[NOT_INIT]		= "?",
   404			[SCALAR_VALUE]		= "scalar",
   405			[PTR_TO_CTX]		= "ctx",
   406			[CONST_PTR_TO_MAP]	= "map_ptr",
   407			[PTR_TO_MAP_VALUE]	= "map_value",
   408			[PTR_TO_STACK]		= "fp",
   409			[PTR_TO_PACKET]		= "pkt",
   410			[PTR_TO_PACKET_META]	= "pkt_meta",
   411			[PTR_TO_PACKET_END]	= "pkt_end",
   412			[PTR_TO_FLOW_KEYS]	= "flow_keys",
   413			[PTR_TO_SOCKET]		= "sock",
   414			[PTR_TO_SOCK_COMMON]	= "sock_common",
   415			[PTR_TO_TCP_SOCK]	= "tcp_sock",
   416			[PTR_TO_TP_BUFFER]	= "tp_buffer",
   417			[PTR_TO_XDP_SOCK]	= "xdp_sock",
   418			[PTR_TO_BTF_ID]		= "ptr_",
   419			[PTR_TO_MEM]		= "mem",
   420			[PTR_TO_ARENA]		= "arena",
   421			[PTR_TO_BUF]		= "buf",
   422			[PTR_TO_FUNC]		= "func",
   423			[PTR_TO_INSN]		= "insn",
   424			[PTR_TO_MAP_KEY]	= "map_key",
   425			[CONST_PTR_TO_DYNPTR]	= "dynptr_ptr",
   426		};
   427	
   428		if (type & PTR_MAYBE_NULL) {
   429			if (base_type(type) == PTR_TO_BTF_ID)
   430				strscpy(postfix, "or_null_");
   431			else
   432				strscpy(postfix, "_or_null");
   433		}
   434	
 > 435		snprintf(prefix, sizeof(prefix), "%s%s%s%s%s%s%s%s%s",
   436			 type & MEM_RDONLY ? "rdonly_" : "",
   437			 type & MEM_RINGBUF ? "ringbuf_" : "",
   438			 type & MEM_USER ? "user_" : "",
   439			 type & MEM_PERCPU ? "percpu_" : "",
   440			 type & MEM_RCU ? "rcu_" : "",
   441			 type & PTR_UNTRUSTED ? "untrusted_" : "",
   442			 type & PTR_TRUSTED ? "trusted_" : "",
   443			 type & PTR_UNSANITIZED ? "unsanitized_" : "",
   444			 type & MEM_ARENA ? "typed_arena_" : ""
   445		);
   446	
   447		snprintf(env->tmp_str_buf, TMP_STR_BUF_LEN, "%s%s%s",
   448			 prefix, str[base_type(type)], postfix);
   449		return env->tmp_str_buf;
   450	}
   451	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2026-09-28 20:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 20:21 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-09-28 20:18 [kkdwivedi:typed-arena 8/17] kernel/bpf/log.c:435:59: warning: '%s' directive output may be truncated writing up to 12 bytes into a region of size between 3 and 64 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=202609290429.usknjcji-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=memxor@gmail.com \
    --cc=oe-kbuild-all@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.