From: Andrew Morton <akpm@linux-foundation.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Yang Shi <shy828301@gmail.com>,
chenjie6@huawei.com, linux-mm@kvack.org, tj@kernel.org,
lizefan@huawei.com
Subject: Re: [PATCH] mm:bugfix check return value of ioremap_prot
Date: Fri, 3 Aug 2018 16:05:57 -0700 [thread overview]
Message-ID: <20180803160557.5d7c5f8e20b526b8bd071146@linux-foundation.org> (raw)
In-Reply-To: <20180803124631.GA13803@avx2>
On Fri, 3 Aug 2018 15:47:01 +0300 Alexey Dobriyan <adobriyan@gmail.com> wrote:
> On Thu, Aug 02, 2018 at 02:02:22PM -0700, Andrew Morton wrote:
> > On Thu, 2 Aug 2018 09:47:52 -0700 Yang Shi <shy828301@gmail.com> wrote:
> >
> > > On Thu, Aug 2, 2018 at 12:37 AM, <chenjie6@huawei.com> wrote:
> > > > From: chen jie <chen jie@chenjie6@huwei.com>
> > > >
> > > > ioremap_prot can return NULL which could lead to an oops
> > >
> > > What oops? You'd better to have the oops information in your commit log.
> >
> > Doesn't matter much - the code is clearly buggy.
> >
> > Looking at the callers, I have suspicions about
> > fs/proc/base.c:environ_read(). It's assuming that access_remote_vm()
> > returns an errno. But it doesn't - it returns number of bytes copied.
> >
> > Alexey, could you please take a look? While in there, I'd suggest
> > adding some return value documentation to __access_remote_vm() and
> > access_remote_vm(). Thanks.
>
> This is true: remote VM accessors return number of bytes copied
> but ->access returns len/-E. Returning "int" is deceptive.
It's more than deceptive - it's flat-out buggy for >4G copy attempts.
And highly dubious for 2G-4G copies, where it might return a negative
int.
I suppose that access_remote_vm() should strictly return a ptrdiff_t,
but we hardly ever use that. size_t will do.
prev parent reply other threads:[~2018-08-03 23:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-02 7:37 chenjie6
2018-08-02 16:47 ` Yang Shi
2018-08-02 21:02 ` Andrew Morton
2018-08-03 12:47 ` Alexey Dobriyan
2018-08-03 23:05 ` Andrew Morton [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=20180803160557.5d7c5f8e20b526b8bd071146@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=adobriyan@gmail.com \
--cc=chenjie6@huawei.com \
--cc=linux-mm@kvack.org \
--cc=lizefan@huawei.com \
--cc=shy828301@gmail.com \
--cc=tj@kernel.org \
/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