* [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
@ 2026-09-28 20:18 kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-09-28 20:18 UTC (permalink / raw)
To: Kumar Kartikeya Dwivedi; +Cc: oe-kbuild-all
tree: https://github.com/kkdwivedi/linux typed-arena
head: f6fd10fe616e1927b9c398a528edc49c6593c06a
commit: 51aabdea74c4d256db3227960617f361a660436f [8/17] bpf: Trust typed pointer fields of typed arena objects
config: x86_64-randconfig-2100-20260928 (https://download.01.org/0day-ci/archive/20260928/202609282220.CsGpM47r-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260928/202609282220.CsGpM47r-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/202609282220.CsGpM47r-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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [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
@ 2026-09-28 20:21 kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-09-28 20:21 UTC (permalink / raw)
To: Kumar Kartikeya Dwivedi; +Cc: oe-kbuild-all
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-28 20:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
-- strict thread matches above, loose matches on Subject: below --
2026-09-28 20:21 kernel test robot
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.