All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Po-Hao Su <supohaosu@gmail.com>
Cc: linux-mm@kvack.org
Subject: Re: do_mmap Function Issue Report
Date: Wed, 28 Mar 2018 10:04:07 -0700	[thread overview]
Message-ID: <20180328170407.GB639@bombadil.infradead.org> (raw)
In-Reply-To: <CAD5U=y8Q-9G+6n9bRs1BbirwhAJ5z0-CS7sG1q8ypqLaDyyHgQ@mail.gmail.com>

On Wed, Mar 28, 2018 at 11:19:30PM +0800, Po-Hao Su wrote:
> I am writing in reference to report a bug in *do_mmap(...)* function.
> Recently, I found that there seems a bug after *get_unmapped_area(...)
> *function
> is return.
> *do_mmap(...) *function will check the *addr *parameter is aligned on a
> page boundary or not after *get_unmapped_area(...)* function is return.
> But it will return *addr *parameter, not an error(probably to *-EINVAL*)
> while address not aligned on a page boundary.
> Therefore, I think address not aligned on a page boundary should be an
> error(*-EINVAL*).

Hi Po-Hao,

I'm afraid you've misunderstood the intent of this code.  The 'addr'
returned from get_unmapped_area() may be an errno, in which case we
want to return it.  Successful invocations of get_unmapped_area do,
of course, return an aligned address.  Your patch would make us return
-EINVAL for all errors, covering up the actual cause of the error (eg
-ENOMEM or -ENODEV)

      reply	other threads:[~2018-03-28 17:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 15:19 do_mmap Function Issue Report Po-Hao Su
2018-03-28 17:04 ` Matthew Wilcox [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=20180328170407.GB639@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=supohaosu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.