summaryrefslogtreecommitdiffstats
path: root/mm/fadvise.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-06-11 11:25:50 +0200
committerIngo Molnar <mingo@kernel.org>2016-06-11 11:25:50 +0200
commit50c0587eedc15235144216f2d2a5bd2a85e03289 (patch)
tree74f24e52bba71efea51dc8ada3ac5427aa1627e5 /mm/fadvise.c
parent3b290398638ee4e57f1fb2e35c02005cba9a737f (diff)
parent75d089d12a66a8662d888ff60a9eaea230fed53e (diff)
downloadop-kernel-dev-50c0587eedc15235144216f2d2a5bd2a85e03289.zip
op-kernel-dev-50c0587eedc15235144216f2d2a5bd2a85e03289.tar.gz
Merge branch 'linus' into x86/asm, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'mm/fadvise.c')
-rw-r--r--mm/fadvise.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mm/fadvise.c b/mm/fadvise.c
index b8024fa..6c707bf 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -126,6 +126,17 @@ SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice)
*/
start_index = (offset+(PAGE_SIZE-1)) >> PAGE_SHIFT;
end_index = (endbyte >> PAGE_SHIFT);
+ if ((endbyte & ~PAGE_MASK) != ~PAGE_MASK) {
+ /* First page is tricky as 0 - 1 = -1, but pgoff_t
+ * is unsigned, so the end_index >= start_index
+ * check below would be true and we'll discard the whole
+ * file cache which is not what was asked.
+ */
+ if (end_index == 0)
+ break;
+
+ end_index--;
+ }
if (end_index >= start_index) {
unsigned long count = invalidate_mapping_pages(mapping,
OpenPOWER on IntegriCloud