lkml.org 
[lkml]   [2020]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] panic: prevent panic_timeout * 1000 from overflow
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).

\
 
 \ /
  Last update: 2020-07-14 04:53    [W:0.055 / U:2.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site