All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: Changming Liu <charley.ashbringer@gmail.com>,
	keescook@chromium.org, mcgrof@kernel.org, yzaikin@google.com,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] sysctl: add bound to panic_timeout to prevent overflow
Date: Fri, 10 Jul 2020 12:28:03 +0100	[thread overview]
Message-ID: <20200710112803.GI12769@casper.infradead.org> (raw)
In-Reply-To: <b50e8198-ca2e-eb44-ed71-e4ca27f48232@infradead.org>

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.

  reply	other threads:[~2020-07-10 11:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10  3:22 [PATCH] sysctl: add bound to panic_timeout to prevent overflow Changming Liu
2020-07-10  3:31 ` Randy Dunlap
2020-07-10 11:28   ` Matthew Wilcox [this message]
2020-07-10 22:28     ` charley.ashbringer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200710112803.GI12769@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=charley.ashbringer@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=yzaikin@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.