[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'
kernel test robot <[email protected]>
| Newsgroups | dev.linux.lists.oe-kbuild-all,dev.linux.lists.llvm |
|---|---|
| Message-ID | <[email protected]> |
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/[email protected]/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/[email protected]/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 <[email protected]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ 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