Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: <charley.ashbringer@gmail.com>
To: "'Matthew Wilcox'" <willy@infradead.org>,
"'Randy Dunlap'" <rdunlap@infradead.org>
Cc: <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 18:28:45 -0400 [thread overview]
Message-ID: <0d4601d65709$7a0e2d80$6e2a8880$@gmail.com> (raw)
In-Reply-To: <20200710112803.GI12769@casper.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.
Thanks for the feedback, I too agree this should be better than
modifying the sysctl, considering how localized and neat this
change is. It's also more readable. Setting a bound in sysctl.c
which is dependent on the constant value in panic.c is not a very
good idea.
I agree changing i from long to long long is necessary.
I'll submit a v2 patch enforcing this shortly.
Cheers,
Changming
prev parent reply other threads:[~2020-07-10 22:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-10 3:22 Changming Liu
2020-07-10 3:31 ` Randy Dunlap
2020-07-10 11:28 ` Matthew Wilcox
2020-07-10 22:28 ` charley.ashbringer [this message]
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='0d4601d65709$7a0e2d80$6e2a8880$@gmail.com' \
--to=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=willy@infradead.org \
--cc=yzaikin@google.com \
--subject='RE: [PATCH] sysctl: add bound to panic_timeout to prevent overflow' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).