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

From: kernel test robot
Date: Fri Jan 19 2024 - 20:00:38 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-defconfig (https://download.01.org/0day-ci/archive/20240120/202401200837.b9DEGdBT-lkp@xxxxxxxxx/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240120/202401200837.b9DEGdBT-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/202401200837.b9DEGdBT-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

kernel/trace/trace_probe.c: In function 'traceprobe_expand_dentry':
>> kernel/trace/trace_probe.c:1106:36: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
if (snprintf(new_argv, len, "+0x%lx(%s)",
~~^
%x


vim +1106 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