aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2005-11-07 03:59:11 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:34 -0500
commit1047aa7723997620ba03a21429d2c5d923ebf48f (patch)
treea0c5f4cf585833262e959d5d0c8be91ebb3932e0 /include
parentcdb32dc90bd38503befd1f4d0b762a1ace09bb28 (diff)
[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')
-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));
200 200
201#define __get_user(x, ptr) \ 201#define __get_user(x, ptr) \
202({ \ 202({ \
203 __typeof__(*(ptr)) __x; \
204 int __gu_err; \ 203 int __gu_err; \
205 __chk_user_ptr(ptr); \ 204 __chk_user_ptr(ptr); \
206 switch (sizeof(*(ptr))) { \ 205 switch (sizeof(*(ptr))) { \
207 case 1: \ 206 case 1: { \
208 case 2: \ 207 unsigned char __x; \
209 case 4: \ 208 __get_user_asm(__x, ptr, __gu_err); \
210 case 8: \ 209 (x) = (__typeof__(*(ptr))) __x; \
210 break; \
211 }; \
212 case 2: { \
213 unsigned short __x; \
214 __get_user_asm(__x, ptr, __gu_err); \
215 (x) = (__typeof__(*(ptr))) __x; \
216 break; \
217 }; \
218 case 4: { \
219 unsigned int __x; \
220 __get_user_asm(__x, ptr, __gu_err); \
221 (x) = (__typeof__(*(ptr))) __x; \
222 break; \
223 }; \
224 case 8: { \
225 unsigned long long __x; \
211 __get_user_asm(__x, ptr, __gu_err); \ 226 __get_user_asm(__x, ptr, __gu_err); \
227 (x) = (__typeof__(*(ptr))) __x; \
212 break; \ 228 break; \
229 }; \
213 default: \ 230 default: \
214 __get_user_bad(); \ 231 __get_user_bad(); \
215 break; \ 232 break; \
216 } \ 233 } \
217 (x) = __x; \
218 __gu_err; \ 234 __gu_err; \
219}) 235})
220 236