[rcu:dev.2021.08.25a 109/115] kernel/time/tick-oneshot.c:27:55: warning: integer overflow in expression of type 'long int' results in '-1857093632'
From: kernel test robot
Date: Thu Sep 02 2021 - 19:13:53 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2021.08.25a
head: 2ba1d046d9bc5b4496027d120e3ddcdfbb2fe9f4
commit: cbe3af2f0b14d8998c4e4765c699c07d0da1ac2b [109/115] EXP cpu: Check for negative expires in hrtimer_reprogram() and tick_program_event()
config: nds32-allyesconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?id=cbe3af2f0b14d8998c4e4765c699c07d0da1ac2b
git remote add rcu https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
git fetch --no-tags rcu dev.2021.08.25a
git checkout cbe3af2f0b14d8998c4e4765c699c07d0da1ac2b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=nds32
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:11,
from include/linux/kernel.h:19,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/node.h:18,
from include/linux/cpu.h:17,
from kernel/time/tick-oneshot.c:10:
kernel/time/tick-oneshot.c: In function 'tick_program_event':
>> kernel/time/tick-oneshot.c:27:55: warning: integer overflow in expression of type 'long int' results in '-1857093632' [-Woverflow]
27 | WARN_ON_ONCE(expires < -KTIME_MAX + 24 * 3600 * NSEC_PER_SEC);
| ^
include/linux/once_lite.h:15:41: note: in definition of macro 'DO_ONCE_LITE_IF'
15 | bool __ret_do_once = !!(condition); \
| ^~~~~~~~~
kernel/time/tick-oneshot.c:27:9: note: in expansion of macro 'WARN_ON_ONCE'
27 | WARN_ON_ONCE(expires < -KTIME_MAX + 24 * 3600 * NSEC_PER_SEC);
| ^~~~~~~~~~~~
vim +27 kernel/time/tick-oneshot.c
> 10 #include <linux/cpu.h>
11 #include <linux/err.h>
12 #include <linux/hrtimer.h>
13 #include <linux/interrupt.h>
14 #include <linux/percpu.h>
15 #include <linux/profile.h>
16 #include <linux/sched.h>
17
18 #include "tick-internal.h"
19
20 /**
21 * tick_program_event
22 */
23 int tick_program_event(ktime_t expires, int force)
24 {
25 struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev);
26
> 27 WARN_ON_ONCE(expires < -KTIME_MAX + 24 * 3600 * NSEC_PER_SEC);
28 if (unlikely(expires == KTIME_MAX)) {
29 /*
30 * We don't need the clock event device any more, stop it.
31 */
32 clockevents_switch_state(dev, CLOCK_EVT_STATE_ONESHOT_STOPPED);
33 dev->next_event = KTIME_MAX;
34 return 0;
35 }
36
37 if (unlikely(clockevent_state_oneshot_stopped(dev))) {
38 /*
39 * We need the clock event again, configure it in ONESHOT mode
40 * before using it.
41 */
42 clockevents_switch_state(dev, CLOCK_EVT_STATE_ONESHOT);
43 }
44
45 return clockevents_program_event(dev, expires, force);
46 }
47
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip