mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Reese Faucette" <reesefaucette@gmail.com>
Cc: <linux-kernel@vger.kernel.org>, <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] overflow check calculation in mm/mmap.c is incorrect linux-3.12.38
Date: Thu, 7 May 2015 16:53:56 -0700	[thread overview]
Message-ID: <20150507165356.6efa045e5e1179ef4f46fdb9@linux-foundation.org> (raw)
In-Reply-To: <007301d08304$85881420$90983c60$@gmail.com>

On Wed, 29 Apr 2015 22:14:19 -0700 "Reese Faucette" <reesefaucette@gmail.com> wrote:

> When checking for overflow, the code in mm/mmap.c compares the first byte
> *after* the end of mapped region to the start of the region instead of the
> last byte of the mapped region.  This prevents mapping a region which abuts
> the end of physical space, as mmap() incorrectly rejects the region with
> -EOVERFLOW, because pgoff + (len >> PAGE_SHIFT) will be 0, which is < pgoff.
> -reese
> 
> Reese Faucette
> Cisco Systems, Inc.
> 
> ====================================================
> --- mm/mmap.c
> +++ mm/mmap.c
> @@ -1241,7 +1241,7 @@
>                 return -ENOMEM;
> 
>         /* offset overflow? */
> -       if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
> +       if ((pgoff + (len >> PAGE_SHIFT) - 1) < pgoff)
>                 return -EOVERFLOW;
> 
>         /* Too many mappings? */

Looks right.

Please send a Signed-off-by: for this patch, as per
Documentation/SubmittingPatches, section 11.  Please also let me know
whether the authorship should be you@gmail.com or some Cisco address,
as people often prefer.

  reply	other threads:[~2015-05-07 23:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30  5:14 Reese Faucette
2015-05-07 23:53 ` Andrew Morton [this message]
2015-05-08  9:46 ` Rasmus Villemoes
2015-05-13 16:58   ` Reese Faucette

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=20150507165356.6efa045e5e1179ef4f46fdb9@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reesefaucette@gmail.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

Powered by JetHome