sh: Fix mmap2 for handling differing PAGE_SIZEs.
mmap2 uses a fixed page shift of 12, regardless of the PAGE_SIZE setting. Fix up the mmap2 code to add some sanity checks on the mapping, and to update pgoff accordingly. Error handling bits based on 4280e3126f641898f0ed1a931645373d3489e2a6 ("frv: fix mmap2 error handling"). Signed-off-by: Toshinobu Sugioka <sugioka@itonet.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
aefe647572
commit
8c31813f31
@ -63,6 +63,15 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
|
|||||||
unsigned long prot, unsigned long flags,
|
unsigned long prot, unsigned long flags,
|
||||||
unsigned long fd, unsigned long pgoff)
|
unsigned long fd, unsigned long pgoff)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* The shift for mmap2 is constant, regardless of PAGE_SIZE
|
||||||
|
* setting.
|
||||||
|
*/
|
||||||
|
if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
pgoff >>= PAGE_SHIFT - 12;
|
||||||
|
|
||||||
return do_mmap2(addr, len, prot, flags, fd, pgoff);
|
return do_mmap2(addr, len, prot, flags, fd, pgoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user