All of lore.kernel.org
 help / color / mirror / Atom feed
* [sashal-stable:pending-5.4 46/75] 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 *'))
@ 2021-11-22 10:01 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-11-22 10:01 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5028 bytes --]

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/commit/?id=3f22c9fce5f5817075f812f37fcffbefce477a69
        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@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(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26403 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-22 10:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-22 10:01 [sashal-stable:pending-5.4 46/75] 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 *')) 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.