summaryrefslogtreecommitdiffstats
path: root/include/asm-s390/uaccess.h
diff options
context:
space:
mode:
authorMartin Schwidefsky2005-11-07 09:59:11 +0100
committerLinus Torvalds2005-11-07 16:53:34 +0100
commit1047aa7723997620ba03a21429d2c5d923ebf48f (patch)
treea0c5f4cf585833262e959d5d0c8be91ebb3932e0 /include/asm-s390/uaccess.h
parent[PATCH] s390: duplicate timeout in qdio (diff)
downloadkernel-qcow2-linux-1047aa7723997620ba03a21429d2c5d923ebf48f.tar.gz
kernel-qcow2-linux-1047aa7723997620ba03a21429d2c5d923ebf48f.tar.xz
kernel-qcow2-linux-1047aa7723997620ba03a21429d2c5d923ebf48f.zip
[PATCH] s390: const pointer uaccess
Using __typeof__(*ptr) on a pointer to const makes the __x variable in __get_user const as well. The latest gcc will refuse to write to it. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-s390/uaccess.h')
-rw-r--r--include/asm-s390/uaccess.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h
index 38a5cf8ab9e3..10a619da4761 100644
--- a/include/asm-s390/uaccess.h
+++ b/include/asm-s390/uaccess.h
@@ -200,21 +200,37 @@ extern int __put_user_bad(void) __attribute__((noreturn));
#define __get_user(x, ptr) \
({ \
- __typeof__(*(ptr)) __x; \
int __gu_err; \
__chk_user_ptr(ptr); \
switch (sizeof(*(ptr))) { \
- case 1: \
- case 2: \
- case 4: \
- case 8: \
+ case 1: { \
+ unsigned char __x; \
+ __get_user_asm(__x, ptr, __gu_err); \
+ (x) = (__typeof__(*(ptr))) __x; \
+ break; \
+ }; \
+ case 2: { \
+ unsigned short __x; \
+ __get_user_asm(__x, ptr, __gu_err); \
+ (x) = (__typeof__(*(ptr))) __x; \
+ break; \
+ }; \
+ case 4: { \
+ unsigned int __x; \
+ __get_user_asm(__x, ptr, __gu_err); \
+ (x) = (__typeof__(*(ptr))) __x; \
+ break; \
+ }; \
+ case 8: { \
+ unsigned long long __x; \
__get_user_asm(__x, ptr, __gu_err); \
+ (x) = (__typeof__(*(ptr))) __x; \
break; \
+ }; \
default: \
__get_user_bad(); \
break; \
} \
- (x) = __x; \
__gu_err; \
})