All of lore.kernel.org
 help / color / mirror / Atom feed
* [tglx-devel:timers/clocksource 7/7] kernel/time/clocksource.c:318 watchdog_check_skew() error: buffer overflow 'wd->cpu_ts' 2 <= 7
@ 2026-01-24 12:58 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-01-24 12:58 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Thomas Gleixner <tglx@linutronix.de>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git timers/clocksource
head:   b0d625cda6d12b60b10a0018c784fe42be4a9604
commit: b0d625cda6d12b60b10a0018c784fe42be4a9604 [7/7] clocksource: Rewrite watchdog code completely
:::::: branch date: 14 hours ago
:::::: commit date: 14 hours ago
config: x86_64-randconfig-161-20260124 (https://download.01.org/0day-ci/archive/20260124/202601242056.dsSZRYxd-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
smatch version: v0.5.0-8994-gd50c5a4c

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/202601242056.dsSZRYxd-lkp@intel.com/

smatch warnings:
kernel/time/clocksource.c:318 watchdog_check_skew() error: buffer overflow 'wd->cpu_ts' 2 <= 7

vim +318 kernel/time/clocksource.c

db3a34e17433de Paul E. McKenney 2021-05-27  298  
b0d625cda6d12b Thomas Gleixner  2025-12-20  299  static void watchdog_check_skew(struct watchdog_cpu_data *wd, int index)
fa218f1cce6ba4 Paul E. McKenney 2021-05-27  300  {
b0d625cda6d12b Thomas Gleixner  2025-12-20  301  	u64 prev, now, delta, start = ktime_get_raw_fast_ns();
b0d625cda6d12b Thomas Gleixner  2025-12-20  302  	int local = index, remote = (index + 1) & 0x1;
b0d625cda6d12b Thomas Gleixner  2025-12-20  303  	struct clocksource *cs = wd->cs;
fa218f1cce6ba4 Paul E. McKenney 2021-05-27  304  
b0d625cda6d12b Thomas Gleixner  2025-12-20  305  	/* Set the local timestamp so that the first iteration works correctly */
b0d625cda6d12b Thomas Gleixner  2025-12-20  306  	wd->cpu_ts[local] = cs->read(cs);
fa218f1cce6ba4 Paul E. McKenney 2021-05-27  307  
b0d625cda6d12b Thomas Gleixner  2025-12-20  308  	/* Signal arrival */
b0d625cda6d12b Thomas Gleixner  2025-12-20  309  	atomic_inc(&wd->seq);
fa218f1cce6ba4 Paul E. McKenney 2021-05-27  310  
b0d625cda6d12b Thomas Gleixner  2025-12-20  311  	for (int seq = local + 2; seq < WATCHDOG_REMOTE_MAX_SEQ; seq += 2) {
b0d625cda6d12b Thomas Gleixner  2025-12-20  312  		if (!watchdog_wait_seq(wd, start, seq))
fa218f1cce6ba4 Paul E. McKenney 2021-05-27  313  			return;
fa218f1cce6ba4 Paul E. McKenney 2021-05-27  314  
b0d625cda6d12b Thomas Gleixner  2025-12-20  315  		prev = wd->cpu_ts[remote];
b0d625cda6d12b Thomas Gleixner  2025-12-20  316  		now = cs->read(cs);
b0d625cda6d12b Thomas Gleixner  2025-12-20  317  		delta = (now - prev) & cs->mask;
b0d625cda6d12b Thomas Gleixner  2025-12-20 @318  		wd->cpu_ts[local] = now;
fa218f1cce6ba4 Paul E. McKenney 2021-05-27  319  
b0d625cda6d12b Thomas Gleixner  2025-12-20  320  		if (delta > cs->max_raw_delta) {
b0d625cda6d12b Thomas Gleixner  2025-12-20  321  			watchdog_set_result(wd, WD_CPU_SKEWED);
b0d625cda6d12b Thomas Gleixner  2025-12-20  322  			return;
fa218f1cce6ba4 Paul E. McKenney 2021-05-27  323  		}
fa218f1cce6ba4 Paul E. McKenney 2021-05-27  324  
b0d625cda6d12b Thomas Gleixner  2025-12-20  325  		/* Hand over to the remote CPU */
b0d625cda6d12b Thomas Gleixner  2025-12-20  326  		atomic_inc(&wd->seq);
b0d625cda6d12b Thomas Gleixner  2025-12-20  327  	}
fa218f1cce6ba4 Paul E. McKenney 2021-05-27  328  }
7560c02bdffb7c Paul E. McKenney 2021-05-27  329  

-- 
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:[~2026-01-24 12:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-24 12:58 [tglx-devel:timers/clocksource 7/7] kernel/time/clocksource.c:318 watchdog_check_skew() error: buffer overflow 'wd->cpu_ts' 2 <= 7 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.