* kernel/trace/trace_functions_graph.c:955:34-40: opportunity for str_true_false(retval)
@ 2026-11-02 3:17 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-11-02 3:17 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Julia Lawall
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: pengdonglin <pengdonglin@xiaomi.com>
CC: Steven Rostedt <rostedt@goodmis.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
commit: 2557f93014d8d3dcab9dda20130412df591fd996 fgraph: Enhance funcgraph-retval with BTF-based type-aware output
date: 2 weeks ago
:::::: branch date: 6 hours ago
:::::: commit date: 2 weeks ago
config: mips-randconfig-r2106-20261101 (https://download.01.org/0day-ci/archive/20261102/202611020428.L48GPs7r-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 8f6b51ca8bab1d49006ddaa042bc7e4e7306975d)
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
| Fixes: 2557f93014d8 ("fgraph: Enhance funcgraph-retval with BTF-based type-aware output")
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202611020428.L48GPs7r-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> kernel/trace/trace_functions_graph.c:955:34-40: opportunity for str_true_false(retval)
vim +955 kernel/trace/trace_functions_graph.c
a1be9ccc57f07d Donglin Peng 2023-04-08 893
2557f93014d8d3 pengdonglin 2026-09-16 894 if (print_retval) {
2557f93014d8d3 pengdonglin 2026-09-16 895 int fmt = RETVAL_FMT_HEX;
2557f93014d8d3 pengdonglin 2026-09-16 896
2557f93014d8d3 pengdonglin 2026-09-16 897 hex_format = !!(opt_flags & TRACE_GRAPH_PRINT_RETVAL_HEX);
2557f93014d8d3 pengdonglin 2026-09-16 898 btf_trim_retval((unsigned long)func, &retval, &print_retval, &fmt,
2557f93014d8d3 pengdonglin 2026-09-16 899 hex_format);
2557f93014d8d3 pengdonglin 2026-09-16 900 if (print_retval) {
2557f93014d8d3 pengdonglin 2026-09-16 901 if (hex_format)
2557f93014d8d3 pengdonglin 2026-09-16 902 retval_fmt = RETVAL_FMT_HEX;
2557f93014d8d3 pengdonglin 2026-09-16 903
2557f93014d8d3 pengdonglin 2026-09-16 904 if (retval && retval_fmt != RETVAL_FMT_HEX &&
2557f93014d8d3 pengdonglin 2026-09-16 905 !(fmt & RETVAL_FMT_BTF)) {
a1be9ccc57f07d Donglin Peng 2023-04-08 906 /* Check if the return value matches the negative format */
a1be9ccc57f07d Donglin Peng 2023-04-08 907 if (IS_ENABLED(CONFIG_64BIT) && (retval & BIT(31)) &&
a1be9ccc57f07d Donglin Peng 2023-04-08 908 (((u64)retval) >> 32) == 0) {
21e92806d39c68 Donglin Peng 2024-09-14 909 err_code = sign_extend64(retval, 31);
a1be9ccc57f07d Donglin Peng 2023-04-08 910 } else {
a1be9ccc57f07d Donglin Peng 2023-04-08 911 err_code = retval;
a1be9ccc57f07d Donglin Peng 2023-04-08 912 }
a1be9ccc57f07d Donglin Peng 2023-04-08 913
a1be9ccc57f07d Donglin Peng 2023-04-08 914 if (!IS_ERR_VALUE(err_code))
a1be9ccc57f07d Donglin Peng 2023-04-08 915 err_code = 0;
21e92806d39c68 Donglin Peng 2024-09-14 916 }
a1be9ccc57f07d Donglin Peng 2023-04-08 917
2557f93014d8d3 pengdonglin 2026-09-16 918 if (retval_fmt == RETVAL_FMT_HEX) {
2557f93014d8d3 pengdonglin 2026-09-16 919 retval_fmt |= (fmt & RETVAL_FMT_TRUNC);
2557f93014d8d3 pengdonglin 2026-09-16 920 } else {
2557f93014d8d3 pengdonglin 2026-09-16 921 if (err_code && fmt & RETVAL_FMT_HEX)
2557f93014d8d3 pengdonglin 2026-09-16 922 fmt = (fmt & ~RETVAL_FMT_HEX) | RETVAL_FMT_DEC;
2557f93014d8d3 pengdonglin 2026-09-16 923 retval_fmt = fmt;
2557f93014d8d3 pengdonglin 2026-09-16 924 }
2557f93014d8d3 pengdonglin 2026-09-16 925 }
2557f93014d8d3 pengdonglin 2026-09-16 926 }
2557f93014d8d3 pengdonglin 2026-09-16 927
21e92806d39c68 Donglin Peng 2024-09-14 928 if (entry) {
21e92806d39c68 Donglin Peng 2024-09-14 929 if (entry->ent.type != TRACE_GRAPH_RETADDR_ENT)
21e92806d39c68 Donglin Peng 2024-09-14 930 print_retaddr = false;
21e92806d39c68 Donglin Peng 2024-09-14 931
ff5c9c576e7545 Sven Schnelle 2025-02-27 932 trace_seq_printf(s, "%ps", func);
ff5c9c576e7545 Sven Schnelle 2025-02-27 933
ff5c9c576e7545 Sven Schnelle 2025-02-27 934 if (args_size >= FTRACE_REGS_MAX_ARGS * sizeof(long)) {
c9703d17d2c86e Donglin Peng 2026-01-12 935 print_function_args(s, FGRAPH_ENTRY_ARGS(entry), (unsigned long)func);
ff5c9c576e7545 Sven Schnelle 2025-02-27 936 trace_seq_putc(s, ';');
ff5c9c576e7545 Sven Schnelle 2025-02-27 937 } else
ff5c9c576e7545 Sven Schnelle 2025-02-27 938 trace_seq_puts(s, "();");
ff5c9c576e7545 Sven Schnelle 2025-02-27 939
21e92806d39c68 Donglin Peng 2024-09-14 940 if (print_retval || print_retaddr)
21e92806d39c68 Donglin Peng 2024-09-14 941 trace_seq_puts(s, " /*");
a1be9ccc57f07d Donglin Peng 2023-04-08 942 } else {
21e92806d39c68 Donglin Peng 2024-09-14 943 print_retaddr = false;
21e92806d39c68 Donglin Peng 2024-09-14 944 trace_seq_printf(s, "} /* %ps", func);
21e92806d39c68 Donglin Peng 2024-09-14 945 }
21e92806d39c68 Donglin Peng 2024-09-14 946
21e92806d39c68 Donglin Peng 2024-09-14 947 if (print_retaddr)
21e92806d39c68 Donglin Peng 2024-09-14 948 print_graph_retaddr(s, (struct fgraph_retaddr_ent_entry *)entry,
21e92806d39c68 Donglin Peng 2024-09-14 949 trace_flags, false);
21e92806d39c68 Donglin Peng 2024-09-14 950
21e92806d39c68 Donglin Peng 2024-09-14 951 if (print_retval) {
2557f93014d8d3 pengdonglin 2026-09-16 952 if (retval_fmt & RETVAL_FMT_HEX)
21e92806d39c68 Donglin Peng 2024-09-14 953 trace_seq_printf(s, " ret=0x%lx", retval);
2557f93014d8d3 pengdonglin 2026-09-16 954 else if (retval_fmt & RETVAL_FMT_BOOL)
2557f93014d8d3 pengdonglin 2026-09-16 @955 trace_seq_printf(s, " ret=%s", retval ? "true" : "false");
2557f93014d8d3 pengdonglin 2026-09-16 956 else if (retval_fmt & RETVAL_FMT_UNSIGNED)
2557f93014d8d3 pengdonglin 2026-09-16 957 trace_seq_printf(s, " ret=%lu", retval);
a1be9ccc57f07d Donglin Peng 2023-04-08 958 else
2557f93014d8d3 pengdonglin 2026-09-16 959 trace_seq_printf(s, " ret=%ld", err_code ?: retval);
2557f93014d8d3 pengdonglin 2026-09-16 960
2557f93014d8d3 pengdonglin 2026-09-16 961 if (retval_fmt & RETVAL_FMT_TRUNC)
2557f93014d8d3 pengdonglin 2026-09-16 962 trace_seq_printf(s, "(trunc)");
a1be9ccc57f07d Donglin Peng 2023-04-08 963 }
21e92806d39c68 Donglin Peng 2024-09-14 964
21e92806d39c68 Donglin Peng 2024-09-14 965 if (!entry || print_retval || print_retaddr)
485acd207d7daf Steven Rostedt 2025-04-11 966 trace_seq_puts(s, " */");
a1be9ccc57f07d Donglin Peng 2023-04-08 967 }
a1be9ccc57f07d Donglin Peng 2023-04-08 968
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-02 3:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-02 3:17 kernel/trace/trace_functions_graph.c:955:34-40: opportunity for str_true_false(retval) 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.