aboutsummaryrefslogtreecommitdiffstats
path: root/arch/score/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/score/kernel')
-rw-r--r--arch/score/kernel/setup.c1
-rw-r--r--arch/score/kernel/sys_score.c29
2 files changed, 7 insertions, 23 deletions
diff --git a/arch/score/kernel/setup.c b/arch/score/kernel/setup.c
index 6a2503c75c4e..6f898c057878 100644
--- a/arch/score/kernel/setup.c
+++ b/arch/score/kernel/setup.c
@@ -49,6 +49,7 @@ static void __init bootmem_init(void)
49 49
50 min_low_pfn = PFN_UP(MEMORY_START); 50 min_low_pfn = PFN_UP(MEMORY_START);
51 max_low_pfn = PFN_UP(MEMORY_START + MEMORY_SIZE); 51 max_low_pfn = PFN_UP(MEMORY_START + MEMORY_SIZE);
52 max_mapnr = max_low_pfn - min_low_pfn;
52 53
53 /* Initialize the boot-time allocator with low memory only. */ 54 /* Initialize the boot-time allocator with low memory only. */
54 bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn, 55 bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
diff --git a/arch/score/kernel/sys_score.c b/arch/score/kernel/sys_score.c
index 001249469866..651096ff8db4 100644
--- a/arch/score/kernel/sys_score.c
+++ b/arch/score/kernel/sys_score.c
@@ -28,6 +28,7 @@
28#include <linux/mm.h> 28#include <linux/mm.h>
29#include <linux/mman.h> 29#include <linux/mman.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/slab.h>
31#include <linux/unistd.h> 32#include <linux/unistd.h>
32#include <linux/syscalls.h> 33#include <linux/syscalls.h>
33#include <asm/syscalls.h> 34#include <asm/syscalls.h>
@@ -36,34 +37,16 @@ asmlinkage long
36sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, 37sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
37 unsigned long flags, unsigned long fd, unsigned long pgoff) 38 unsigned long flags, unsigned long fd, unsigned long pgoff)
38{ 39{
39 int error = -EBADF; 40 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
40 struct file *file = NULL;
41
42 if (pgoff & (~PAGE_MASK >> 12))
43 return -EINVAL;
44
45 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
46 if (!(flags & MAP_ANONYMOUS)) {
47 file = fget(fd);
48 if (!file)
49 return error;
50 }
51
52 down_write(&current->mm->mmap_sem);
53 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
54 up_write(&current->mm->mmap_sem);
55
56 if (file)
57 fput(file);
58
59 return error;
60} 41}
61 42
62asmlinkage long 43asmlinkage long
63sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, 44sys_mmap(unsigned long addr, unsigned long len, unsigned long prot,
64 unsigned long flags, unsigned long fd, off_t pgoff) 45 unsigned long flags, unsigned long fd, off_t offset)
65{ 46{
66 return sys_mmap2(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT); 47 if (unlikely(offset & ~PAGE_MASK))
48 return -EINVAL;
49 return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
67} 50}
68 51
69asmlinkage long 52asmlinkage long