[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1417493050-13594-6-git-send-email-sasha.levin@oracle.com>
Date: Mon, 1 Dec 2014 23:04:10 -0500
From: Sasha Levin <sasha.levin@...cle.com>
To: linux-kernel@...r.kernel.org
Cc: Sasha Levin <sasha.levin@...cle.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
linux-fsdevel@...r.kernel.org
Subject: [PATCH] fs: sync_file_range: avoid overflowing signed calculation
When calculating the end byte for the sync we preform an addition which might
result in an overflow, which is undefined. Avoid it by doing unsigned
addition.
Signed-off-by: Sasha Levin <sasha.levin@...cle.com>
---
fs/sync.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/sync.c b/fs/sync.c
index 6ccfc38..f9cb38f 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -286,7 +286,7 @@ SYSCALL_DEFINE4(sync_file_range, int, fd, loff_t, offset, loff_t, nbytes,
if (flags & ~VALID_FLAGS)
goto out;
- endbyte = offset + nbytes;
+ endbyte = offset + (u64)nbytes;
if ((s64)offset < 0)
goto out;
--
1.7.10.4
--
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