From: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev, llvm@lists.linux.dev
Subject: kernel/bpf/log.c:425:11: warning: bitwise operation between different enumeration types ('enum bpf_reg_type' and 'enum bpf_type_flag')
Date: Mon, 10 Mar 2025 16:08:14 +0800 [thread overview]
Message-ID: <202503101529.rnkM3qaN-lkp@intel.com> (raw)
CC: linux-kernel@vger.kernel.org
TO: Andrii Nakryiko <andrii@kernel.org>
CC: Alexei Starovoitov <ast@kernel.org>
Hi Andrii,
FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 80e54e84911a923c40d7bee33a34c1b4be148d7a
commit: 42feb6620accded89cad5f455665e21281813d79 bpf: move verifier state printing code to kernel/bpf/log.c
date: 1 year, 4 months ago
config: x86_64-buildonly-randconfig-006-20250127 (https://download.01.org/0day-ci/archive/20250310/202503101529.rnkM3qaN-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250310/202503101529.rnkM3qaN-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/202503101529.rnkM3qaN-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from kernel/bpf/log.c:9:
In file included from include/linux/bpf.h:21:
In file included from include/linux/kallsyms.h:13:
In file included from include/linux/mm.h:2177:
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> kernel/bpf/log.c:425:11: warning: bitwise operation between different enumeration types ('enum bpf_reg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
425 | if (type & PTR_MAYBE_NULL) {
| ~~~~ ^ ~~~~~~~~~~~~~~
kernel/bpf/log.c:433:9: warning: bitwise operation between different enumeration types ('enum bpf_reg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
433 | type & MEM_RDONLY ? "rdonly_" : "",
| ~~~~ ^ ~~~~~~~~~~
kernel/bpf/log.c:434:9: warning: bitwise operation between different enumeration types ('enum bpf_reg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
434 | type & MEM_RINGBUF ? "ringbuf_" : "",
| ~~~~ ^ ~~~~~~~~~~~
kernel/bpf/log.c:435:9: warning: bitwise operation between different enumeration types ('enum bpf_reg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
435 | type & MEM_USER ? "user_" : "",
| ~~~~ ^ ~~~~~~~~
kernel/bpf/log.c:436:9: warning: bitwise operation between different enumeration types ('enum bpf_reg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
436 | type & MEM_PERCPU ? "percpu_" : "",
| ~~~~ ^ ~~~~~~~~~~
kernel/bpf/log.c:437:9: warning: bitwise operation between different enumeration types ('enum bpf_reg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
437 | type & MEM_RCU ? "rcu_" : "",
| ~~~~ ^ ~~~~~~~
kernel/bpf/log.c:438:9: warning: bitwise operation between different enumeration types ('enum bpf_reg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
438 | type & PTR_UNTRUSTED ? "untrusted_" : "",
| ~~~~ ^ ~~~~~~~~~~~~~
kernel/bpf/log.c:439:9: warning: bitwise operation between different enumeration types ('enum bpf_reg_type' and 'enum bpf_type_flag') [-Wenum-enum-conversion]
439 | type & PTR_TRUSTED ? "trusted_" : ""
| ~~~~ ^ ~~~~~~~~~~~
9 warnings generated.
vim +425 kernel/bpf/log.c
392
393 /* string representation of 'enum bpf_reg_type'
394 *
395 * Note that reg_type_str() can not appear more than once in a single verbose()
396 * statement.
397 */
398 const char *reg_type_str(struct bpf_verifier_env *env, enum bpf_reg_type type)
399 {
400 char postfix[16] = {0}, prefix[64] = {0};
401 static const char * const str[] = {
402 [NOT_INIT] = "?",
403 [SCALAR_VALUE] = "scalar",
404 [PTR_TO_CTX] = "ctx",
405 [CONST_PTR_TO_MAP] = "map_ptr",
406 [PTR_TO_MAP_VALUE] = "map_value",
407 [PTR_TO_STACK] = "fp",
408 [PTR_TO_PACKET] = "pkt",
409 [PTR_TO_PACKET_META] = "pkt_meta",
410 [PTR_TO_PACKET_END] = "pkt_end",
411 [PTR_TO_FLOW_KEYS] = "flow_keys",
412 [PTR_TO_SOCKET] = "sock",
413 [PTR_TO_SOCK_COMMON] = "sock_common",
414 [PTR_TO_TCP_SOCK] = "tcp_sock",
415 [PTR_TO_TP_BUFFER] = "tp_buffer",
416 [PTR_TO_XDP_SOCK] = "xdp_sock",
417 [PTR_TO_BTF_ID] = "ptr_",
418 [PTR_TO_MEM] = "mem",
419 [PTR_TO_BUF] = "buf",
420 [PTR_TO_FUNC] = "func",
421 [PTR_TO_MAP_KEY] = "map_key",
422 [CONST_PTR_TO_DYNPTR] = "dynptr_ptr",
423 };
424
> 425 if (type & PTR_MAYBE_NULL) {
426 if (base_type(type) == PTR_TO_BTF_ID)
427 strncpy(postfix, "or_null_", 16);
428 else
429 strncpy(postfix, "_or_null", 16);
430 }
431
432 snprintf(prefix, sizeof(prefix), "%s%s%s%s%s%s%s",
433 type & MEM_RDONLY ? "rdonly_" : "",
434 type & MEM_RINGBUF ? "ringbuf_" : "",
435 type & MEM_USER ? "user_" : "",
436 type & MEM_PERCPU ? "percpu_" : "",
437 type & MEM_RCU ? "rcu_" : "",
438 type & PTR_UNTRUSTED ? "untrusted_" : "",
439 type & PTR_TRUSTED ? "trusted_" : ""
440 );
441
442 snprintf(env->tmp_str_buf, TMP_STR_BUF_LEN, "%s%s%s",
443 prefix, str[base_type(type)], postfix);
444 return env->tmp_str_buf;
445 }
446
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2025-03-10 8:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 8:08 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-03-04 3:09 kernel/bpf/log.c:425:11: warning: bitwise operation between different enumeration types ('enum bpf_reg_type' and 'enum bpf_type_flag') 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=202503101529.rnkM3qaN-lkp@intel.com \
--to=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox