[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4829CEAF.9020806@us.ibm.com>
Date: Tue, 13 May 2008 12:23:59 -0500
From: Jon Tollefson <kniht@...ibm.com>
To: linux-kernel@...r.kernel.org,
Linux Memory Management List <linux-mm@...ck.org>,
linuxppc-dev <linuxppc-dev@...abs.org>
CC: Paul Mackerras <paulus@...ba.org>, Nick Piggin <npiggin@...e.de>,
Nishanth Aravamudan <nacc@...ibm.com>,
Andi Kleen <andi@...stfloor.org>, Adam Litke <agl@...ibm.com>
Subject: [PATCH 5/6 v2] check for overflow
Adds a check for an overflow in the filesystem size so if someone is
checking with statfs() on a 16G hugetlbfs in a 32bit binary that it
will report back EOVERFLOW instead of a size of 0.
Are other places that need a similar check? I had tried a similar
check in put_compat_statfs64 too but it didn't seem to generate an
EOVERFLOW in my test case.
Signed-off-by: Jon Tollefson <kniht@...ux.vnet.ibm.com>
---
fs/compat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/compat.c b/fs/compat.c
index 2ce4456..6eb6aad 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -196,8 +196,8 @@ static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs *
{
if (sizeof ubuf->f_blocks == 4) {
- if ((kbuf->f_blocks | kbuf->f_bfree | kbuf->f_bavail) &
- 0xffffffff00000000ULL)
+ if ((kbuf->f_blocks | kbuf->f_bfree | kbuf->f_bavail |
+ kbuf->f_bsize | kbuf->f_frsize) & 0xffffffff00000000ULL)
return -EOVERFLOW;
/* f_files and f_ffree may be -1; it's okay
* to stuff that into 32 bits */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists