All of lore.kernel.org
 help / color / mirror / Atom feed
* arch/x86/kernel/kvmclock.c:269 kvmclock_setup_percpu() error: testing array offset 'cpu' after use.
@ 2023-12-03 15:48 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-12-03 15:48 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Thomas Gleixner <tglx@linutronix.de>
CC: Pavel Tatashin <pasha.tatashin@oracle.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   33cc938e65a98f1d29d0a18403dbbee050dcad9a
commit: 95a3d4454bb1cf5bfd666c27fdd2dc188e17c14d x86/kvmclock: Switch kvmclock data to a PER_CPU variable
date:   5 years ago
:::::: branch date: 5 hours ago
:::::: commit date: 5 years ago
config: x86_64-randconfig-x006-20230817 (https://download.01.org/0day-ci/archive/20231203/202312032306.PrSrLRqa-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231203/202312032306.PrSrLRqa-lkp@intel.com/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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202312032306.PrSrLRqa-lkp@intel.com/

smatch warnings:
arch/x86/kernel/kvmclock.c:269 kvmclock_setup_percpu() error: testing array offset 'cpu' after use.

vim +/cpu +269 arch/x86/kernel/kvmclock.c

e499a9b6dc488a Thomas Gleixner 2018-07-19  255  
95a3d4454bb1cf Thomas Gleixner 2018-07-19  256  static int kvmclock_setup_percpu(unsigned int cpu)
95a3d4454bb1cf Thomas Gleixner 2018-07-19  257  {
95a3d4454bb1cf Thomas Gleixner 2018-07-19  258  	struct pvclock_vsyscall_time_info *p = per_cpu(hv_clock_per_cpu, cpu);
95a3d4454bb1cf Thomas Gleixner 2018-07-19  259  
95a3d4454bb1cf Thomas Gleixner 2018-07-19  260  	/*
95a3d4454bb1cf Thomas Gleixner 2018-07-19  261  	 * The per cpu area setup replicates CPU0 data to all cpu
95a3d4454bb1cf Thomas Gleixner 2018-07-19  262  	 * pointers. So carefully check. CPU0 has been set up in init
95a3d4454bb1cf Thomas Gleixner 2018-07-19  263  	 * already.
95a3d4454bb1cf Thomas Gleixner 2018-07-19  264  	 */
95a3d4454bb1cf Thomas Gleixner 2018-07-19  265  	if (!cpu || (p && p != per_cpu(hv_clock_per_cpu, 0)))
95a3d4454bb1cf Thomas Gleixner 2018-07-19  266  		return 0;
95a3d4454bb1cf Thomas Gleixner 2018-07-19  267  
95a3d4454bb1cf Thomas Gleixner 2018-07-19  268  	/* Use the static page for the first CPUs, allocate otherwise */
95a3d4454bb1cf Thomas Gleixner 2018-07-19 @269  	if (cpu < HVC_BOOT_ARRAY_SIZE)
95a3d4454bb1cf Thomas Gleixner 2018-07-19  270  		p = &hv_clock_boot[cpu];
95a3d4454bb1cf Thomas Gleixner 2018-07-19  271  	else
95a3d4454bb1cf Thomas Gleixner 2018-07-19  272  		p = kzalloc(sizeof(*p), GFP_KERNEL);
95a3d4454bb1cf Thomas Gleixner 2018-07-19  273  
95a3d4454bb1cf Thomas Gleixner 2018-07-19  274  	per_cpu(hv_clock_per_cpu, cpu) = p;
95a3d4454bb1cf Thomas Gleixner 2018-07-19  275  	return p ? 0 : -ENOMEM;
95a3d4454bb1cf Thomas Gleixner 2018-07-19  276  }
95a3d4454bb1cf Thomas Gleixner 2018-07-19  277  

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

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

only message in thread, other threads:[~2023-12-03 15:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-03 15:48 arch/x86/kernel/kvmclock.c:269 kvmclock_setup_percpu() error: testing array offset 'cpu' after use 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.