From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: kernel/time/timekeeping.c:807:19-20: WARNING opportunity for min()
Date: Sun, 24 Nov 2024 22:00:15 +0800 [thread overview]
Message-ID: <202411242103.s1QBLXod-lkp@intel.com> (raw)
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
next reply other threads:[~2024-11-24 14:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-24 14:00 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-10-31 11:15 kernel/time/timekeeping.c:807:19-20: WARNING opportunity for min() kernel test robot
2024-10-04 0:08 kernel test robot
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=202411242103.s1QBLXod-lkp@intel.com \
--to=lkp@intel.com \
--cc=julia.lawall@inria.fr \
--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.