summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-05-24 22:41:58 +0200
committerDavid S. Miller <davem@davemloft.net>2012-05-24 22:41:58 +0200
commitc5389831cda3b38a56606a348a537a1332f2d729 (patch)
tree1df9f89d287af436be4bd405e50dd3c1d48d354e /arch
parentlib: Sparc's strncpy_from_user is generic enough, move under lib/ (diff)
downloadlinux-c5389831cda3b38a56606a348a537a1332f2d729.tar.xz
linux-c5389831cda3b38a56606a348a537a1332f2d729.zip
sparc: Fix user_addr_max() definition.
We need to use TASK_SIZE because for 64-bit tasks the value of STACK_TOP actually sits in the middle of the address space so we'll get false-negatives. Adjust the TASK_SIZE definition on sparc64 to accomodate this, in the context in which user_addr_max() is used we have the test_thread_flag() definition available but not the one for test_tsk_thread_flag(). Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc/include/asm/processor_64.h4
-rw-r--r--arch/sparc/include/asm/uaccess.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h
index e713db249931..6ca7709971d2 100644
--- a/arch/sparc/include/asm/processor_64.h
+++ b/arch/sparc/include/asm/processor_64.h
@@ -42,7 +42,9 @@
#define TASK_SIZE_OF(tsk) \
(test_tsk_thread_flag(tsk,TIF_32BIT) ? \
(1UL << 32UL) : ((unsigned long)-VPTE_SIZE))
-#define TASK_SIZE TASK_SIZE_OF(current)
+#define TASK_SIZE \
+ (test_thread_flag(TIF_32BIT) ? \
+ (1UL << 32UL) : ((unsigned long)-VPTE_SIZE))
#ifdef __KERNEL__
#define STACK_TOP32 ((1UL << 32UL) - PAGE_SIZE)
diff --git a/arch/sparc/include/asm/uaccess.h b/arch/sparc/include/asm/uaccess.h
index 20c2acb06332..0167d26d0d1d 100644
--- a/arch/sparc/include/asm/uaccess.h
+++ b/arch/sparc/include/asm/uaccess.h
@@ -7,7 +7,7 @@
#endif
#define user_addr_max() \
- (segment_eq(get_fs(), USER_DS) ? STACK_TOP : ~0UL)
+ (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL)
extern long strncpy_from_user(char *dest, const char __user *src, long count);