[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131211012046.30655.22882.stgit@birch.djwong.org>
Date: Tue, 10 Dec 2013 17:20:46 -0800
From: "Darrick J. Wong" <darrick.wong@...cle.com>
To: tytso@....edu, darrick.wong@...cle.com
Cc: linux-ext4@...r.kernel.org
Subject: [PATCH 22/74] e4defrag: defensively check results of
sysconf(_SC_PAGESIZE)
sysconf(_SC_PAGESIZE) will probably never return an error, but just in
case it does, we shouldn't pass what looks like a huge number to
sync_file_range() and posix_fadvise().
Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com>
---
misc/e4defrag.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/misc/e4defrag.c b/misc/e4defrag.c
index b6e2e31..07d56d9 100644
--- a/misc/e4defrag.c
+++ b/misc/e4defrag.c
@@ -473,6 +473,9 @@ static int defrag_fadvise(int fd, struct move_extent defrag_data,
unsigned int i;
loff_t offset;
+ if (pagesize < 1)
+ return -1;
+
offset = (loff_t)defrag_data.orig_start * block_size;
offset = (offset / pagesize) * pagesize;
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists