All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-stable-rc:linux-4.4.y 8875/9999] arch/x86/kvm/pmu_intel.c:93:10: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long')
@ 2020-12-10  3:43 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-12-10  3:43 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
head:   95a3867e897abd7811196123f81a119a75aba863
commit: c3ccf2fdfc89871042659ae1463fd1d9665fdfef [8875/9999] KVM: x86: Protect pmu_intel.c from Spectre-v1/L1TF attacks
config: x86_64-randconfig-a016-20201208 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project a2f922140f5380571fb74179f2bf622b3b925697)
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
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=c3ccf2fdfc89871042659ae1463fd1d9665fdfef
        git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
        git fetch --no-tags linux-stable-rc linux-4.4.y
        git checkout c3ccf2fdfc89871042659ae1463fd1d9665fdfef
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross 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 >>):

   arch/x86/include/asm/uaccess.h:772:26: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
           if (likely(sz < 0 || sz >= n))
                                ~~ ^  ~
   include/linux/compiler.h:150:73: note: expanded from macro 'likely'
   #  define likely(x)     (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
                                                                               ^
   include/linux/compiler.h:139:29: note: expanded from macro '__branch_check__'
                           ______r = likely_notrace(x);                    \
                                                    ^
   include/linux/compiler.h:126:47: note: expanded from macro 'likely_notrace'
   #define likely_notrace(x)       __builtin_expect(!!(x), 1)
                                                       ^
   In file included from arch/x86/kvm/pmu_intel.c:15:
   In file included from include/linux/kvm_host.h:10:
   In file included from include/linux/hardirq.h:8:
   In file included from arch/x86/include/asm/hardirq.h:5:
   In file included from include/linux/irq.h:418:
   In file included from arch/x86/include/asm/hw_irq.h:26:
   In file included from arch/x86/include/asm/sections.h:5:
   arch/x86/include/asm/uaccess.h:772:26: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
           if (likely(sz < 0 || sz >= n))
                                ~~ ^  ~
   include/linux/compiler.h:150:43: note: expanded from macro 'likely'
   #  define likely(x)     (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
                                                 ^
   In file included from arch/x86/kvm/pmu_intel.c:15:
   In file included from include/linux/kvm_host.h:10:
   In file included from include/linux/hardirq.h:8:
   In file included from arch/x86/include/asm/hardirq.h:5:
   In file included from include/linux/irq.h:418:
   In file included from arch/x86/include/asm/hw_irq.h:26:
   In file included from arch/x86/include/asm/sections.h:5:
   arch/x86/include/asm/uaccess.h:772:26: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
           if (likely(sz < 0 || sz >= n))
                                ~~ ^  ~
   include/linux/compiler.h:150:51: note: expanded from macro 'likely'
   #  define likely(x)     (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
                                                         ^
   In file included from arch/x86/kvm/pmu_intel.c:15:
   In file included from include/linux/kvm_host.h:15:
   In file included from include/linux/sched.h:61:
   In file included from include/linux/cgroup-defs.h:16:
   include/linux/percpu-refcount.h:177:3: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
                   this_cpu_add(*percpu_count, nr);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/percpu-defs.h:526:33: note: expanded from macro 'this_cpu_add'
   #define this_cpu_add(pcp, val)          __pcpu_size_call(this_cpu_add_, pcp, val)
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/percpu-defs.h:397:11: note: expanded from macro '__pcpu_size_call'
                   case 8: stem##8(variable, __VA_ARGS__);break;           \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   <scratch space>:261:1: note: expanded from here
   this_cpu_add_8
   ^
   arch/x86/include/asm/percpu.h:478:35: note: expanded from macro 'this_cpu_add_8'
   #define this_cpu_add_8(pcp, val)                percpu_add_op((pcp), val)
                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/percpu.h:130:31: note: expanded from macro 'percpu_add_op'
                                 ((val) == 1 || (val) == -1)) ?            \
                                                 ~~~  ^  ~~
   In file included from arch/x86/kvm/pmu_intel.c:15:
   In file included from include/linux/kvm_host.h:15:
   In file included from include/linux/sched.h:61:
   In file included from include/linux/cgroup-defs.h:16:
   include/linux/percpu-refcount.h:276:3: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
                   this_cpu_sub(*percpu_count, nr);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/percpu-defs.h:536:33: note: expanded from macro 'this_cpu_sub'
   #define this_cpu_sub(pcp, val)          this_cpu_add(pcp, -(typeof(pcp))(val))
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/percpu-defs.h:526:33: note: expanded from macro 'this_cpu_add'
   #define this_cpu_add(pcp, val)          __pcpu_size_call(this_cpu_add_, pcp, val)
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/percpu-defs.h:397:11: note: expanded from macro '__pcpu_size_call'
                   case 8: stem##8(variable, __VA_ARGS__);break;           \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   <scratch space>:97:1: note: expanded from here
   this_cpu_add_8
   ^
   arch/x86/include/asm/percpu.h:478:35: note: expanded from macro 'this_cpu_add_8'
   #define this_cpu_add_8(pcp, val)                percpu_add_op((pcp), val)
                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/percpu.h:130:31: note: expanded from macro 'percpu_add_op'
                                 ((val) == 1 || (val) == -1)) ?            \
                                                 ~~~  ^  ~~
   In file included from arch/x86/kvm/pmu_intel.c:18:
   In file included from arch/x86/kvm/x86.h:5:
   arch/x86/kvm/kvm_cache_regs.h:43:32: warning: implicit conversion from enumeration type 'enum kvm_reg_ex' to different enumeration type 'enum kvm_reg' [-Wenum-conversion]
                   kvm_x86_ops->cache_reg(vcpu, VCPU_EXREG_PDPTR);
                   ~~~~~~~~~~~                  ^~~~~~~~~~~~~~~~
   In file included from arch/x86/kvm/pmu_intel.c:21:
   arch/x86/kvm/pmu.h:100:10: warning: comparison of integers of different signs: 'u32' (aka 'unsigned int') and 'int' [-Wsign-compare]
           if (msr >= base && msr < base + pmu->nr_arch_fixed_counters) {
               ~~~ ^  ~~~~
   arch/x86/kvm/pmu_intel.c:42:16: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
           for (i = 0; i < pmu->nr_arch_fixed_counters; i++) {
                       ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/pmu_intel.c:76:16: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
           for (i = 0; i < ARRAY_SIZE(intel_arch_events); i++)
                       ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/kvm/pmu_intel.c:93:10: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
           if (idx >= size)
               ~~~ ^  ~~~~
   13 warnings generated.

vim +93 arch/x86/kvm/pmu_intel.c

    87	
    88	static unsigned intel_find_fixed_event(int idx)
    89	{
    90		u32 event;
    91		size_t size = ARRAY_SIZE(fixed_pmc_events);
    92	
  > 93		if (idx >= size)
    94			return PERF_COUNT_HW_MAX;
    95	
    96		event = fixed_pmc_events[array_index_nospec(idx, size)];
    97		return intel_arch_events[event].event_type;
    98	}
    99	

---
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: 32093 bytes --]

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

only message in thread, other threads:[~2020-12-10  3:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10  3:43 [linux-stable-rc:linux-4.4.y 8875/9999] arch/x86/kvm/pmu_intel.c:93:10: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') 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.