summaryrefslogtreecommitdiff
path: root/arch/microblaze/include/asm/uaccess.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-10 18:19:52 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-10 18:19:52 +0400
commita1f0bcccffe508b36f8eb0bd39771d4bedc683a8 (patch)
treee4ca41552b440c9a69d70bacd4d1c26bdc35b694 /arch/microblaze/include/asm/uaccess.h
parent70eba4226d9718946941c7be0c8cb66d431e7686 (diff)
parenta047775e7eff511a529bf65f3b3e9c11443789b2 (diff)
downloadlinux-a1f0bcccffe508b36f8eb0bd39771d4bedc683a8.tar.xz
Merge branch 'next' of git://git.monstr.eu/linux-2.6-microblaze
Pull microblaze updates from Michal Simek. * 'next' of git://git.monstr.eu/linux-2.6-microblaze: microblaze: Enable IRQ in arch_cpu_idle microblaze: Fix uaccess_ok macro microblaze: Add support for new cpu versions and target architecture microblaze: Do not select OPT_LIB_ASM by default microblaze: Fix initrd support microblaze: Do not use r6 in head.S microblaze: pci: Remove duplicated header microblaze: Set the default irq_domain microblaze: pci: Remove duplicated include from pci-common.c
Diffstat (limited to 'arch/microblaze/include/asm/uaccess.h')
-rw-r--r--arch/microblaze/include/asm/uaccess.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h
index a1ab5f0009ef..efe59d881789 100644
--- a/arch/microblaze/include/asm/uaccess.h
+++ b/arch/microblaze/include/asm/uaccess.h
@@ -90,17 +90,25 @@ static inline int ___range_ok(unsigned long addr, unsigned long size)
#else
-/*
- * Address is valid if:
- * - "addr", "addr + size" and "size" are all below the limit
- */
-#define access_ok(type, addr, size) \
- (get_fs().seg >= (((unsigned long)(addr)) | \
- (size) | ((unsigned long)(addr) + (size))))
-
-/* || printk("access_ok failed for %s at 0x%08lx (size %d), seg 0x%08x\n",
- type?"WRITE":"READ",addr,size,get_fs().seg)) */
-
+static inline int access_ok(int type, const void __user *addr,
+ unsigned long size)
+{
+ if (!size)
+ goto ok;
+
+ if ((get_fs().seg < ((unsigned long)addr)) ||
+ (get_fs().seg < ((unsigned long)addr + size - 1))) {
+ pr_debug("ACCESS fail: %s at 0x%08x (size 0x%x), seg 0x%08x\n",
+ type ? "WRITE" : "READ ", (u32)addr, (u32)size,
+ (u32)get_fs().seg);
+ return 0;
+ }
+ok:
+ pr_debug("ACCESS OK: %s at 0x%08x (size 0x%x), seg 0x%08x\n",
+ type ? "WRITE" : "READ ", (u32)addr, (u32)size,
+ (u32)get_fs().seg);
+ return 1;
+}
#endif
#ifdef CONFIG_MMU