All of lore.kernel.org
 help / color / mirror / Atom feed
* kernel/time/timekeeping.c:807:19-20: WARNING opportunity for min()
@ 2024-10-04  0:08 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2024-10-04  0:08 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Julia Lawall

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Adrian Hunter <adrian.hunter@intel.com>
CC: Thomas Gleixner <tglx@linutronix.de>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8c245fe7dde3bf776253550fc914a36293db4ff3
commit: fcf190c369149c3b04539797cedf28741eb14164 timekeeping: Make delta calculation overflow safe
date:   6 months ago
:::::: branch date: 7 hours ago
:::::: commit date: 6 months ago
config: mips-randconfig-r062-20241004 (https://download.01.org/0day-ci/archive/20241004/202410040856.IAPgOjON-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project fef3566a25ff0e34fb87339ba5e13eca17cec00f)

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: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202410040856.IAPgOjON-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> kernel/time/timekeeping.c:807:19-20: WARNING opportunity for min()

vim +807 kernel/time/timekeeping.c

cc06268c6a87db1 Thomas Gleixner    2011-11-13  787  
8524070b7982d76 John Stultz        2007-05-08  788  /**
155ec60226ae0ae Martin Schwidefsky 2009-08-14  789   * timekeeping_forward_now - update clock to the current time
6e5a91901c2dff3 Alex Shi           2020-11-13  790   * @tk:		Pointer to the timekeeper to update
8524070b7982d76 John Stultz        2007-05-08  791   *
9a055117d3d9cb5 Roman Zippel       2008-08-20  792   * Forward the current clock to update its state since the last call to
9a055117d3d9cb5 Roman Zippel       2008-08-20  793   * update_wall_time(). This is useful before significant clock changes,
9a055117d3d9cb5 Roman Zippel       2008-08-20  794   * as it avoids having to deal with this time offset explicitly.
8524070b7982d76 John Stultz        2007-05-08  795   */
f726a697d06102e John Stultz        2012-07-13  796  static void timekeeping_forward_now(struct timekeeper *tk)
8524070b7982d76 John Stultz        2007-05-08  797  {
a5a1d1c2914b531 Thomas Gleixner    2016-12-21  798  	u64 cycle_now, delta;
8524070b7982d76 John Stultz        2007-05-08  799  
ceea5e3771ed237 John Stultz        2017-06-08  800  	cycle_now = tk_clock_read(&tk->tkr_mono);
876e78818def298 Peter Zijlstra     2015-03-19  801  	delta = clocksource_delta(cycle_now, tk->tkr_mono.cycle_last, tk->tkr_mono.mask);
876e78818def298 Peter Zijlstra     2015-03-19  802  	tk->tkr_mono.cycle_last = cycle_now;
4a4ad80d32cea69 Peter Zijlstra     2015-03-19  803  	tk->tkr_raw.cycle_last  = cycle_now;
8524070b7982d76 John Stultz        2007-05-08  804  
fcf190c369149c3 Adrian Hunter      2024-03-25  805  	while (delta > 0) {
fcf190c369149c3 Adrian Hunter      2024-03-25  806  		u64 max = tk->tkr_mono.clock->max_cycles;
fcf190c369149c3 Adrian Hunter      2024-03-25 @807  		u64 incr = delta < max ? delta : max;
fc6eead7c1e2e53 John Stultz        2017-05-22  808  
fcf190c369149c3 Adrian Hunter      2024-03-25  809  		tk->tkr_mono.xtime_nsec += incr * tk->tkr_mono.mult;
fcf190c369149c3 Adrian Hunter      2024-03-25  810  		tk->tkr_raw.xtime_nsec += incr * tk->tkr_raw.mult;
fc6eead7c1e2e53 John Stultz        2017-05-22  811  		tk_normalize_xtime(tk);
fcf190c369149c3 Adrian Hunter      2024-03-25  812  		delta -= incr;
fcf190c369149c3 Adrian Hunter      2024-03-25  813  	}
8524070b7982d76 John Stultz        2007-05-08  814  }
8524070b7982d76 John Stultz        2007-05-08  815  

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* kernel/time/timekeeping.c:807:19-20: WARNING opportunity for min()
@ 2024-10-31 11:15 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2024-10-31 11:15 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Julia Lawall

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Adrian Hunter <adrian.hunter@intel.com>
CC: Thomas Gleixner <tglx@linutronix.de>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0fc810ae3ae110f9e2fcccce80fc8c8d62f97907
commit: fcf190c369149c3b04539797cedf28741eb14164 timekeeping: Make delta calculation overflow safe
date:   7 months ago
:::::: branch date: 14 hours ago
:::::: commit date: 7 months ago
config: i386-randconfig-051-20241031 (https://download.01.org/0day-ci/archive/20241031/202410311931.twiNKosB-lkp@intel.com/config)
compiler: clang version 19.1.2 (https://github.com/llvm/llvm-project 7ba7d8e2f7b6445b60679da826210cdde29eaf8b)

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: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202410311931.twiNKosB-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> kernel/time/timekeeping.c:807:19-20: WARNING opportunity for min()

vim +807 kernel/time/timekeeping.c

cc06268c6a87db1 Thomas Gleixner    2011-11-13  787  
8524070b7982d76 John Stultz        2007-05-08  788  /**
155ec60226ae0ae Martin Schwidefsky 2009-08-14  789   * timekeeping_forward_now - update clock to the current time
6e5a91901c2dff3 Alex Shi           2020-11-13  790   * @tk:		Pointer to the timekeeper to update
8524070b7982d76 John Stultz        2007-05-08  791   *
9a055117d3d9cb5 Roman Zippel       2008-08-20  792   * Forward the current clock to update its state since the last call to
9a055117d3d9cb5 Roman Zippel       2008-08-20  793   * update_wall_time(). This is useful before significant clock changes,
9a055117d3d9cb5 Roman Zippel       2008-08-20  794   * as it avoids having to deal with this time offset explicitly.
8524070b7982d76 John Stultz        2007-05-08  795   */
f726a697d06102e John Stultz        2012-07-13  796  static void timekeeping_forward_now(struct timekeeper *tk)
8524070b7982d76 John Stultz        2007-05-08  797  {
a5a1d1c2914b531 Thomas Gleixner    2016-12-21  798  	u64 cycle_now, delta;
8524070b7982d76 John Stultz        2007-05-08  799  
ceea5e3771ed237 John Stultz        2017-06-08  800  	cycle_now = tk_clock_read(&tk->tkr_mono);
876e78818def298 Peter Zijlstra     2015-03-19  801  	delta = clocksource_delta(cycle_now, tk->tkr_mono.cycle_last, tk->tkr_mono.mask);
876e78818def298 Peter Zijlstra     2015-03-19  802  	tk->tkr_mono.cycle_last = cycle_now;
4a4ad80d32cea69 Peter Zijlstra     2015-03-19  803  	tk->tkr_raw.cycle_last  = cycle_now;
8524070b7982d76 John Stultz        2007-05-08  804  
fcf190c369149c3 Adrian Hunter      2024-03-25  805  	while (delta > 0) {
fcf190c369149c3 Adrian Hunter      2024-03-25  806  		u64 max = tk->tkr_mono.clock->max_cycles;
fcf190c369149c3 Adrian Hunter      2024-03-25 @807  		u64 incr = delta < max ? delta : max;
fc6eead7c1e2e53 John Stultz        2017-05-22  808  
fcf190c369149c3 Adrian Hunter      2024-03-25  809  		tk->tkr_mono.xtime_nsec += incr * tk->tkr_mono.mult;
fcf190c369149c3 Adrian Hunter      2024-03-25  810  		tk->tkr_raw.xtime_nsec += incr * tk->tkr_raw.mult;
fc6eead7c1e2e53 John Stultz        2017-05-22  811  		tk_normalize_xtime(tk);
fcf190c369149c3 Adrian Hunter      2024-03-25  812  		delta -= incr;
fcf190c369149c3 Adrian Hunter      2024-03-25  813  	}
8524070b7982d76 John Stultz        2007-05-08  814  }
8524070b7982d76 John Stultz        2007-05-08  815  

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* kernel/time/timekeeping.c:807:19-20: WARNING opportunity for min()
@ 2024-11-24 14:00 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2024-11-24 14:00 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Julia Lawall

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Adrian Hunter <adrian.hunter@intel.com>
CC: Thomas Gleixner <tglx@linutronix.de>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   9f16d5e6f220661f73b36a4be1b21575651d8833
commit: fcf190c369149c3b04539797cedf28741eb14164 timekeeping: Make delta calculation overflow safe
date:   8 months ago
:::::: branch date: 14 hours ago
:::::: commit date: 8 months ago
config: x86_64-randconfig-102-20241124 (https://download.01.org/0day-ci/archive/20241124/202411242103.s1QBLXod-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

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: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202411242103.s1QBLXod-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> kernel/time/timekeeping.c:807:19-20: WARNING opportunity for min()

vim +807 kernel/time/timekeeping.c

cc06268c6a87db Thomas Gleixner    2011-11-13  787  
8524070b7982d7 John Stultz        2007-05-08  788  /**
155ec60226ae0a Martin Schwidefsky 2009-08-14  789   * timekeeping_forward_now - update clock to the current time
6e5a91901c2dff Alex Shi           2020-11-13  790   * @tk:		Pointer to the timekeeper to update
8524070b7982d7 John Stultz        2007-05-08  791   *
9a055117d3d9cb Roman Zippel       2008-08-20  792   * Forward the current clock to update its state since the last call to
9a055117d3d9cb Roman Zippel       2008-08-20  793   * update_wall_time(). This is useful before significant clock changes,
9a055117d3d9cb Roman Zippel       2008-08-20  794   * as it avoids having to deal with this time offset explicitly.
8524070b7982d7 John Stultz        2007-05-08  795   */
f726a697d06102 John Stultz        2012-07-13  796  static void timekeeping_forward_now(struct timekeeper *tk)
8524070b7982d7 John Stultz        2007-05-08  797  {
a5a1d1c2914b53 Thomas Gleixner    2016-12-21  798  	u64 cycle_now, delta;
8524070b7982d7 John Stultz        2007-05-08  799  
ceea5e3771ed23 John Stultz        2017-06-08  800  	cycle_now = tk_clock_read(&tk->tkr_mono);
876e78818def29 Peter Zijlstra     2015-03-19  801  	delta = clocksource_delta(cycle_now, tk->tkr_mono.cycle_last, tk->tkr_mono.mask);
876e78818def29 Peter Zijlstra     2015-03-19  802  	tk->tkr_mono.cycle_last = cycle_now;
4a4ad80d32cea6 Peter Zijlstra     2015-03-19  803  	tk->tkr_raw.cycle_last  = cycle_now;
8524070b7982d7 John Stultz        2007-05-08  804  
fcf190c369149c Adrian Hunter      2024-03-25  805  	while (delta > 0) {
fcf190c369149c Adrian Hunter      2024-03-25  806  		u64 max = tk->tkr_mono.clock->max_cycles;
fcf190c369149c Adrian Hunter      2024-03-25 @807  		u64 incr = delta < max ? delta : max;
fc6eead7c1e2e5 John Stultz        2017-05-22  808  
fcf190c369149c Adrian Hunter      2024-03-25  809  		tk->tkr_mono.xtime_nsec += incr * tk->tkr_mono.mult;
fcf190c369149c Adrian Hunter      2024-03-25  810  		tk->tkr_raw.xtime_nsec += incr * tk->tkr_raw.mult;
fc6eead7c1e2e5 John Stultz        2017-05-22  811  		tk_normalize_xtime(tk);
fcf190c369149c Adrian Hunter      2024-03-25  812  		delta -= incr;
fcf190c369149c Adrian Hunter      2024-03-25  813  	}
8524070b7982d7 John Stultz        2007-05-08  814  }
8524070b7982d7 John Stultz        2007-05-08  815  

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-24 14:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-04  0:08 kernel/time/timekeeping.c:807:19-20: WARNING opportunity for min() kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2024-10-31 11:15 kernel test robot
2024-11-24 14:00 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.