From: Marcin Slusarz <marcin.slusarz@gmail.com>
To: Miklos Szeredi <mszeredi@suse.cz>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] fuse: fix possible bug in fuse_direct_io on 64-bit system
Date: Fri, 10 Apr 2009 23:41:35 +0200 [thread overview]
Message-ID: <49DFBD0F.3030800@gmail.com> (raw)
Fix possible bug on 64-bit system when user requests > 4GB of data by
direct_io read/write, but provides smaller buffer.
(passing nbytes>4GB to fuse_get_user_pages truncates nbytes and get_user_pages
is called with wrong value of npages)
Found by gcc:
fs/fuse/file.c: In function 'fuse_direct_io':
fs/fuse/file.c:1002: warning: passing argument 3 of 'fuse_get_user_pages' from incompatible pointer type
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Miklos Szeredi <mszeredi@suse.cz>
---
fs/fuse/file.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 2b25133..0bb60c3 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -938,9 +938,9 @@ static void fuse_release_user_pages(struct fuse_req *req, int write)
}
static int fuse_get_user_pages(struct fuse_req *req, const char __user *buf,
- unsigned *nbytesp, int write)
+ size_t *nbytesp, int write)
{
- unsigned nbytes = *nbytesp;
+ size_t nbytes = *nbytesp;
unsigned long user_addr = (unsigned long) buf;
unsigned offset = user_addr & ~PAGE_MASK;
int npages;
@@ -955,7 +955,7 @@ static int fuse_get_user_pages(struct fuse_req *req, const char __user *buf,
return 0;
}
- nbytes = min(nbytes, (unsigned) FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT);
+ nbytes = min(nbytes, (size_t) FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT);
npages = (nbytes + offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
npages = clamp(npages, 1, FUSE_MAX_PAGES_PER_REQ);
down_read(¤t->mm->mmap_sem);
--
next reply other threads:[~2009-04-10 21:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-10 21:41 Marcin Slusarz [this message]
2009-04-11 22:11 ` [PATCH] fuse: fix possible bug in fuse_direct_io on 64-bit system Miklos Szeredi
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=49DFBD0F.3030800@gmail.com \
--to=marcin.slusarz@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mszeredi@suse.cz \
/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.