From: mnipxh <mnipxh@gmail.com>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
viro@zeniv.linux.org.uk
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
yanmin_zhang@linux.intel.com, shuox.liu@intel.com
Subject: [PATCH] fs/buffer.c: grow_buffers: fix the uncorrect check
Date: Sun, 01 Jun 2014 02:12:05 +0800 [thread overview]
Message-ID: <538A1B75.5030107@gmail.com> (raw)
When pgoff_t index is 32bit, sector_t block is 64bit, need check if block number is too big.
If block is bigger than (4Gb * PAGE_SIZE), index becomes a wrong value.
Commit e5657933863f43cc6bb76a54d659303dafaa9e58 wants to do this. But it gives an uncorrect check.
I think block != index << sizebits is correct. And it can detect such issue above.
Signed-off-by: xinhui.pan <xinhuix.pan@intel.com>
---
fs/buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index 9ddb9fc..1a674a6 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1081,7 +1081,7 @@ grow_buffers(struct block_device *bdev, sector_t block, int size)
* Check for a block which wants to lie outside our maximum possible
* pagecache index. (this comparison is done using sector_t types).
*/
- if (unlikely(index != block >> sizebits)) {
+ if (unlikely(block != index << sizebits)) {
char b[BDEVNAME_SIZE];
printk(KERN_ERR "%s: requested out-of-range block %llu for "
--
1.9.1
next reply other threads:[~2014-05-31 18:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-31 18:12 mnipxh [this message]
2014-05-31 19:39 ` [PATCH] fs/buffer.c: grow_buffers: fix the uncorrect check Linus Torvalds
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=538A1B75.5030107@gmail.com \
--to=mnipxh@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shuox.liu@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
--cc=yanmin_zhang@linux.intel.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;
as well as URLs for NNTP newsgroup(s).