linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "zhangyi (F)" <yi.zhang@huawei.com>
Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	mawilcox@microsoft.com, ross.zwisler@linux.intel.com,
	viro@zeniv.linux.org.uk, miaoxie@huawei.com
Subject: Re: [PATCH] dax: fix potential overflow on 32bit machine
Date: Mon, 4 Dec 2017 21:24:07 -0800	[thread overview]
Message-ID: <20171205052407.GA20757@bombadil.infradead.org> (raw)
In-Reply-To: <20171205033210.38338-1-yi.zhang@huawei.com>

On Tue, Dec 05, 2017 at 11:32:10AM +0800, zhangyi (F) wrote:
> On 32bit machine, when mmap2 a large enough file with pgoff more than
> ULONG_MAX >> PAGE_SHIFT, it will trigger offset overflow and lead to
> unmap the wrong page in dax_insert_mapping_entry(). This patch cast
> pgoff to 64bit to prevent the overflow.

You're quite correct, and you've solved this problem the same way as the
other half-dozen users in the kernel with the problem, so good job.

I think we can do better though.  How does this look?

       reply	other threads:[~2017-12-05  5:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20171205033210.38338-1-yi.zhang@huawei.com>
2017-12-05  5:24 ` Matthew Wilcox [this message]
2017-12-05  8:40   ` zhangyi (F)
2017-12-05 17:07   ` Ross Zwisler
2017-12-05 17:37     ` Matthew Wilcox
2017-12-05 19:19       ` Ross Zwisler
2017-12-05 19:54         ` Matthew Wilcox

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=20171205052407.GA20757@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mawilcox@microsoft.com \
    --cc=miaoxie@huawei.com \
    --cc=ross.zwisler@linux.intel.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yi.zhang@huawei.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