Skip to contentSkip to conversation

arch_mmap_check() on mn10300

RFC PATCH In review Al Viro 3 participants 3 messages Dec 5, 2009 – Dec 6, 2009 Generic include/asm header files

lore
Share & tools
lore

Al Viro

author
#0 lore raw

RFC PATCH 11/18 arch_mmap_check() on mn10300

---
 arch/mn10300/include/asm/mman.h   |    5 +++++
 arch/mn10300/kernel/sys_mn10300.c |    5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)
arch/mn10300/include/asm/mman.h +5 -0
index 8eebf89..712f7b0 100644
@@ -1 +1,6 @@
 #include <asm-generic/mman.h>
+
+#define MIN_MAP_ADDR	PAGE_SIZE	/* minimum fixed mmap address */
+
+#define arch_mmap_chech(addr, len, flags) \
+	(((flags) & MAP_FIXED && (addr) < MIN_MAP_ADDR) ? -EINVAL : 0)
arch/mn10300/kernel/sys_mn10300.c +0 -5
index 8ca5af0..ec4100d 100644
@@ -23,8 +23,6 @@
 
 #include <asm/uaccess.h>
 
-#define MIN_MAP_ADDR	PAGE_SIZE	/* minimum fixed mmap address */
-
 /*
  * memory mapping syscall
  */
@@ -37,9 +35,6 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
 
 	flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
 
-	if (flags & MAP_FIXED && addr < MIN_MAP_ADDR)
-		goto out;
-
 	error = -EBADF;
 	if (!(flags & MAP_ANONYMOUS)) {
 		file = fget(fd);
Signature · 1 line
1.5.6.5
#1 lore raw

arch/mn10300/include/asm/mman.h line 6

Quoted 2 lines · Al Viro
arch/mn10300/include/asm/mman.h +2 -0
+#define arch_mmap_chech(addr, len, flags) \
+	(((flags) & MAP_FIXED && (addr) < MIN_MAP_ADDR) ? -EINVAL : 0)

I believe that should be arch_mmap_check().

David

#2 lore raw
Quoted 6 lines · David Howells

arch/mn10300/include/asm/mman.h line 6

Quoted 2 lines · Al Viro
arch/mn10300/include/asm/mman.h +2 -0
+#define arch_mmap_chech(addr, len, flags) \
+	(((flags) & MAP_FIXED && (addr) < MIN_MAP_ADDR) ? -EINVAL : 0)

I believe that should be arch_mmap_check().

D'oh. Thanks for spotting (and that, BTW, is a nice demonstration of the reasons why "arch hooks with default" thing is bad). Fixed in my tree, will go in the next repost.