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@xxxxxxxxxx> --- 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@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html