tree:
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git
pending-5.4
head: 2f06062940cf83ed6c2aeeb9e0c5138f08b486a9
commit: 3f22c9fce5f5817075f812f37fcffbefce477a69 [46/75] tracing: Add length protection to
histogram string copies
config: x86_64-randconfig-a001-20211122 (attached as .config)
compiler: clang version 14.0.0 (
https://github.com/llvm/llvm-project
c133fb321f7ca6083ce15b6aa5bf89de6600e649)
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
#
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git/c...
git remote add sashal-stable
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git
git fetch --no-tags sashal-stable pending-5.4
git checkout 3f22c9fce5f5817075f812f37fcffbefce477a69
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
> kernel/trace/trace_events_hist.c:3535:11: warning: comparison of
distinct pointer types ('typeof (val->size) *' (aka 'unsigned int *')
and 'typeof (32) *' (aka 'int *')) [-Wcompare-distinct-pointer-types]
size = min(val->size, STR_VAR_LEN_MAX);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:875:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:866:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/kernel.h:856:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/kernel.h:842:29: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
> kernel/trace/trace_events_hist.c:5367:12: warning: comparison of
distinct pointer types ('typeof (hist_field->size) *' (aka 'unsigned int
*') and 'typeof (32) *' (aka 'int *'))
[-Wcompare-distinct-pointer-types]
size =
min(hist_field->size, STR_VAR_LEN_MAX);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:875:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:866:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/kernel.h:856:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/kernel.h:842:29: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
kernel/trace/trace_events_hist.c:5861:6: warning: variable 'ret' set but not
used [-Wunused-but-set-variable]
int ret;
^
3 warnings generated.
vim +3535 kernel/trace/trace_events_hist.c
3510
3511 static inline void __update_field_vars(struct tracing_map_elt *elt,
3512 struct ring_buffer_event *rbe,
3513 void *rec,
3514 struct field_var **field_vars,
3515 unsigned int n_field_vars,
3516 unsigned int field_var_str_start)
3517 {
3518 struct hist_elt_data *elt_data = elt->private_data;
3519 unsigned int i, j, var_idx;
3520 u64 var_val;
3521
3522 for (i = 0, j = field_var_str_start; i < n_field_vars; i++) {
3523 struct field_var *field_var = field_vars[i];
3524 struct hist_field *var = field_var->var;
3525 struct hist_field *val = field_var->val;
3526
3527 var_val = val->fn(val, elt, rbe, rec);
3528 var_idx = var->var.idx;
3529
3530 if (val->flags & HIST_FIELD_FL_STRING) {
3531 char *str = elt_data->field_var_str[j++];
3532 char *val_str = (char *)(uintptr_t)var_val;
3533 unsigned int size;
3534
3535 size = min(val->size, STR_VAR_LEN_MAX);
3536 strscpy(str, val_str, size);
3537 var_val = (u64)(uintptr_t)str;
3538 }
3539 tracing_map_set_var(elt, var_idx, var_val);
3540 }
3541 }
3542
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org