[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200710112803.GI12769@casper.infradead.org>
Date: Fri, 10 Jul 2020 12:28:03 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Randy Dunlap <rdunlap@...radead.org>
Cc: Changming Liu <charley.ashbringer@...il.com>,
keescook@...omium.org, mcgrof@...nel.org, yzaikin@...gle.com,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] sysctl: add bound to panic_timeout to prevent overflow
On Thu, Jul 09, 2020 at 08:31:39PM -0700, Randy Dunlap wrote:
> > +/* this is needed for setting boundery for panic_timeout to prevent it from overflow*/
>
> boundary (or max value) overflow */
>
> > +static int panic_time_max = INT_MAX / 1000;
Or just simplify the comment.
/* Prevent overflow in panic() */
Or perhaps better, fix panic() to not overflow.
- for (i = 0; i < panic_timeout * 1000; i += PANIC_TIMER_STEP) {
+ for (i = 0; i / 1000 < panic_timeout; i += PANIC_TIMER_STEP) {
you probably also want to change i to be a long long or the loop may never
terminate.
Powered by blists - more mailing lists