Re: [PATCH 1/3] tracing/probes: support '%pd' type for print struct dentry's name

From: kernel test robot
Date: Sat Jan 20 2024 - 01:27:42 EST


Hi Ye,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.7 next-20240119]
[cannot apply to rostedt-trace/for-next rostedt-trace/for-next-urgent]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Ye-Bin/tracing-probes-support-pd-type-for-print-struct-dentry-s-name/20240119-093912
base: linus/master
patch link: https://lore.kernel.org/r/20240119013848.3111364-2-yebin10%40huawei.com
patch subject: [PATCH 1/3] tracing/probes: support '%pd' type for print struct dentry's name
config: i386-randconfig-051-20240120 (https://download.01.org/0day-ci/archive/20240120/202401201403.aTEbo79S-lkp@xxxxxxxxx/config)
compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240120/202401201403.aTEbo79S-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401201403.aTEbo79S-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> kernel/trace/trace_probe.c:1107:8: warning: format specifies type 'unsigned long' but the argument has type 'unsigned int' [-Wformat]
1106 | if (snprintf(new_argv, len, "+0x%lx(%s)",
| ~~~
| %x
1107 | offsetof(struct dentry, d_name.name), argv) >= len) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.


vim +1107 kernel/trace/trace_probe.c

1095
1096 static char* traceprobe_expand_dentry(const char *argv)
1097 {
1098 #define DENTRY_EXPAND_LEN 7 /* +0xXX() */
1099 char *new_argv;
1100 int len = strlen(argv) + 1 + DENTRY_EXPAND_LEN;
1101
1102 new_argv = kmalloc(len, GFP_KERNEL);
1103 if (!new_argv)
1104 return NULL;
1105
1106 if (snprintf(new_argv, len, "+0x%lx(%s)",
> 1107 offsetof(struct dentry, d_name.name), argv) >= len) {
1108 kfree(new_argv);
1109 return NULL;
1110 }
1111
1112 return new_argv;
1113 }
1114

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