diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-03 15:23:11 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-11 06:44:58 -0500 |
commit | 9206de95b1ea68357996ec02be5db0638a0de2c1 (patch) | |
tree | e32b41a06a8465af0e8cfa0660b517930cc2fea5 /mm/mmap.c | |
parent | 8c7b49b3ecd48923eb64ff57e07a1cdb74782970 (diff) |
Take arch_mmap_check() into get_unmapped_area()
Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r-- | mm/mmap.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -931,13 +931,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | |||
931 | if (!(flags & MAP_FIXED)) | 931 | if (!(flags & MAP_FIXED)) |
932 | addr = round_hint_to_min(addr); | 932 | addr = round_hint_to_min(addr); |
933 | 933 | ||
934 | error = arch_mmap_check(addr, len, flags); | ||
935 | if (error) | ||
936 | return error; | ||
937 | |||
938 | /* Careful about overflows.. */ | 934 | /* Careful about overflows.. */ |
939 | len = PAGE_ALIGN(len); | 935 | len = PAGE_ALIGN(len); |
940 | if (!len || len > TASK_SIZE) | 936 | if (!len) |
941 | return -ENOMEM; | 937 | return -ENOMEM; |
942 | 938 | ||
943 | /* offset overflow? */ | 939 | /* offset overflow? */ |
@@ -1437,6 +1433,14 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, | |||
1437 | unsigned long (*get_area)(struct file *, unsigned long, | 1433 | unsigned long (*get_area)(struct file *, unsigned long, |
1438 | unsigned long, unsigned long, unsigned long); | 1434 | unsigned long, unsigned long, unsigned long); |
1439 | 1435 | ||
1436 | unsigned long error = arch_mmap_check(addr, len, flags); | ||
1437 | if (error) | ||
1438 | return error; | ||
1439 | |||
1440 | /* Careful about overflows.. */ | ||
1441 | if (len > TASK_SIZE) | ||
1442 | return -ENOMEM; | ||
1443 | |||
1440 | get_area = current->mm->get_unmapped_area; | 1444 | get_area = current->mm->get_unmapped_area; |
1441 | if (file && file->f_op && file->f_op->get_unmapped_area) | 1445 | if (file && file->f_op && file->f_op->get_unmapped_area) |
1442 | get_area = file->f_op->get_unmapped_area; | 1446 | get_area = file->f_op->get_unmapped_area; |