From: Davidlohr Bueso <dave@gnu.org>
To: Pekka Enberg <penberg@kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
Sasha Levin <levinsasha928@gmail.com>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] pipe: Fail cleanly when root tries F_SETPIPE_SZ with big size
Date: Fri, 18 Nov 2011 22:20:26 +0100 [thread overview]
Message-ID: <1321651226.3420.0.camel@offbook> (raw)
In-Reply-To: <CAOJsxLG7Q-DEAOXo0SpsBDFRZzFRkRdA4xnP48Khu4QdCrdrWA@mail.gmail.com>
On Fri, 2011-11-18 at 23:04 +0200, Pekka Enberg wrote:
> On Fri, Nov 18, 2011 at 10:04:34PM +0200, Sasha Levin wrote:
> >> + if (nr_pages * sizeof(struct pipe_buffer) > KMALLOC_MAX_SIZE)
> >> + return -ENOMEM;
>
> On Fri, Nov 18, 2011 at 10:25 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> > nr_pages is unsigned long, sizeof is greater than 1, KMALLOC_MAX_SIZE is
> > unsigned long... So write that check as KMALLOC_MAX_SIZE / sizeof > nr_pages
>
> We could just use __GFP_NOWARN here and let kcalloc() deal with the
> overflow case.
Yep, that would seem the right place to deal with it, IMHO.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
prev parent reply other threads:[~2011-11-18 21:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-18 20:04 [PATCH] pipe: Fail cleanly when root tries F_SETPIPE_SZ with big size Sasha Levin
2011-11-18 20:25 ` Al Viro
2011-11-18 21:04 ` Pekka Enberg
2011-11-18 21:20 ` Davidlohr Bueso [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=1321651226.3420.0.camel@offbook \
--to=dave@gnu.org \
--cc=levinsasha928@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).