mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Changming <charley.ashbringer@gmail.com>,
	rdunlap@infradead.org, keescook@chromium.org, mcgrof@kernel.org,
	yzaikin@google.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] panic: prevent panic_timeout * 1000 from overflow
Date: Tue, 14 Jul 2020 03:50:58 +0100	[thread overview]
Message-ID: <20200714025058.GZ12769@casper.infradead.org> (raw)
In-Reply-To: <20200713185739.03d576cca0dc9f618ea76d67@linux-foundation.org>

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).


  reply	other threads:[~2020-07-14  2:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0d4601d65709a0e2d80e2a8880gmail.com>
2020-07-11  5:17 ` Changming
2020-07-14  1:57   ` Andrew Morton
2020-07-14  2:50     ` Matthew Wilcox [this message]
2020-07-16 23:15       ` [PATCH v3] " Changming Liu
2020-07-16  4:48     ` [PATCH v2] " 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=20200714025058.GZ12769@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=charley.ashbringer@gmail.com \
    --cc=keescook@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®