Re: [PATCH v2] panic: prevent panic_timeout * 1000 from overflow
From: Matthew Wilcox
Date: Mon Jul 13 2020 - 22:51:08 EST
On Mon, Jul 13, 2020 at 06:57:39PM -0700, Andrew Morton wrote:
> +++ a/kernel/panic.c
> @@ -313,13 +313,16 @@ void panic(const char *fmt, ...)
> * Delay timeout seconds before rebooting the machine.
> * We can't use the "normal" timers since we just panicked.
> */
> + u64 timeout = panic_timeout * 1000; /* avoid overflow */
1000ULL to not truncate before the assignment.
> + u64 timer;
... as you implied later
u64 timer, timer_next;
> (untested)
Well, there's the rub. Testing requires 49 days (2^32 / 1000 seconds).