All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [tglx-devel:timers/clocksource 7/7] kernel/time/clocksource.c:318 watchdog_check_skew() error: buffer overflow 'wd->cpu_ts' 2 <= 7
Date: Sat, 24 Jan 2026 20:58:58 +0800	[thread overview]
Message-ID: <202601242056.dsSZRYxd-lkp@intel.com> (raw)

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

                 reply	other threads:[~2026-01-24 12:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202601242056.dsSZRYxd-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.