linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matteo Croce <mcroce@redhat.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Christian Brauner <christian@brauner.io>,
	linux-fsdevel@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	Luis Chamberlain <mcgrof@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Zev Weiss <zev@bewilderbeest.net>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max
Date: Wed, 3 Apr 2019 18:40:04 +0200	[thread overview]
Message-ID: <CAGnkfhxBafq4KeR8Jp5XBd7yWrMiofmEwqsCpb_7eL+ddgWagw@mail.gmail.com> (raw)
In-Reply-To: <20190403155108.GI22763@bombadil.infradead.org>

On Wed, Apr 3, 2019 at 5:51 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Wed, Apr 03, 2019 at 05:24:26PM +0200, Matteo Croce wrote:
> > On Wed, Apr 3, 2019 at 4:02 PM Christian Brauner <christian@brauner.io> wrote:
> > > Yeah, maybe but it still feels cleaner and more obvious to just add:
> > >
> > > static long long_zero;
> > >
> > > given that most callers actually seem to want an (unsigned) int.
> > >
> > > I don't have a strong opinion though so if others feel that it's just a
> > > waste of space consider it acked.
> > >
> >
> > Well, given that the value is zero, in this expectional case we could
> > avoid duplicating the symbol and save 4 bytes.
> > What the maintainers think?
>
> If we care about saving four bytes, we could just pass the address of
> ZERO_PAGE(0).

That would work, work too, maybe it's a bit overkill.
int zero is always there and it's static, so enlarging it to long
should be a straightforward fix.
Obviously we can't do it for other numbers, but we can alias it just
for the zero case..

Regards,

--
Matteo Croce
per aspera ad upstream

  reply	other threads:[~2019-04-03 16:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-28 13:03 [PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max Matteo Croce
2019-04-03 11:54 ` Matteo Croce
2019-04-03 14:02 ` Christian Brauner
2019-04-03 15:24   ` Matteo Croce
2019-04-03 15:51     ` Matthew Wilcox
2019-04-03 16:40       ` Matteo Croce [this message]
2019-04-03 17:08         ` Matteo Croce
2019-04-04 14:09           ` Christian Brauner
2019-04-04 14:49             ` Matteo Croce
2019-04-03 17:41 ` Kees Cook
2019-04-04  0:13   ` Matteo Croce

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=CAGnkfhxBafq4KeR8Jp5XBd7yWrMiofmEwqsCpb_7eL+ddgWagw@mail.gmail.com \
    --to=mcroce@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=christian@brauner.io \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=willy@infradead.org \
    --cc=zev@bewilderbeest.net \
    /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;
as well as URLs for NNTP newsgroup(s).