From: kernel test robot <lkp@intel.com>
To: "Thomas Weißschuh (Schneider Electric)"
<thomas.weissschuh@linutronix.de>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [thomas-weissschuh:b4/auxclock-nanosleep 41/41] kernel/time/timekeeping.c:185:36: warning: overflow in expression; result is 568'041'472 with type 'long'
Date: Thu, 27 Aug 2026 13:19:05 +0800 [thread overview]
Message-ID: <202608271347.XtVtsxLQ-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/thomas.weissschuh/linux.git b4/auxclock-nanosleep
head: 87c2db12ba44bf5bea44868e32bd8df048af5586
commit: 87c2db12ba44bf5bea44868e32bd8df048af5586 [41/41] reciprocal
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20260827/202608271347.XtVtsxLQ-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project a908adb93db53c0d630232a5bdab8817495c17eb)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260827/202608271347.XtVtsxLQ-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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608271347.XtVtsxLQ-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> kernel/time/timekeeping.c:185:36: warning: overflow in expression; result is 568'041'472 with type 'long' [-Winteger-overflow]
185 | this_delta = clamp(this_delta, 0, TK_AUX_MONO_CONV_MAX_DELTA_NS);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/time/timekeeping.c:148:45: note: expanded from macro 'TK_AUX_MONO_CONV_MAX_DELTA_NS'
148 | #define TK_AUX_MONO_CONV_MAX_DELTA_NS (400 * NSEC_PER_SEC)
| ^
include/linux/minmax.h:206:59: note: expanded from macro 'clamp'
206 | #define clamp(val, lo, hi) __careful_clamp(auto, val, lo, hi)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
include/linux/minmax.h:195:30: note: expanded from macro '__careful_clamp'
195 | __clamp_once(type, val, lo, hi, __UNIQUE_ID(v_), __UNIQUE_ID(l_), __UNIQUE_ID(h_))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:187:14: note: expanded from macro '__clamp_once'
187 | type uhi = (hi); \
| ^~
kernel/time/timekeeping.c:234:54: warning: overflow in expression; result is -647'710'720 with type 'long' [-Winteger-overflow]
234 | return ktime_sub(mono_now, mono_conv->mono_base) >= TK_AUX_MONO_CONV_FORCE_UPDATE_DELTA_NS;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/time/timekeeping.c:149:53: note: expanded from macro 'TK_AUX_MONO_CONV_FORCE_UPDATE_DELTA_NS'
149 | #define TK_AUX_MONO_CONV_FORCE_UPDATE_DELTA_NS (300 * NSEC_PER_SEC)
| ~~~~^~~~~~~~~~~~~~
kernel/time/timekeeping.c:2291:13: warning: variable 'suspend_timing_needed' set but not used [-Wunused-but-set-global]
2291 | static bool suspend_timing_needed;
| ^
3 warnings generated.
vim +185 kernel/time/timekeeping.c
175
176 static ktime_t ktime_mono_from_to_aux(ktime_t this_now, ktime_t this_base, ktime_t other_base,
177 u32 conv_mult)
178 {
179 ktime_t this_delta, other_delta;
180
181 /* Both operands are guaranteed to be positive, no over- or underflow is possible. */
182 this_delta = ktime_sub(this_now, this_base);
183
184 /* Only values in this range can be converted without overflow. */
> 185 this_delta = clamp(this_delta, 0, TK_AUX_MONO_CONV_MAX_DELTA_NS);
186
187 other_delta = (this_delta * conv_mult) >> TK_AUX_MONO_CONV_SHIFT;
188
189 /*
190 * Underflow is impossible, as other_base is always positive.
191 * Overflow is impossible, as other_base will never become big enough.
192 */
193 return ktime_add(other_base, other_delta);
194 }
195
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-08-27 5:19 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=202608271347.XtVtsxLQ-lkp@intel.com \
--to=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=thomas.weissschuh@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox