aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-h8300/uaccess.h
diff options
context:
space:
mode:
authorYoshinori Sato <ysato@users.sourceforge.jp>2008-03-13 15:32:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-03-13 16:11:43 -0400
commit12d48739d0b5d96efe6b7d26107f5572c6215f4a (patch)
tree0a2fa386b8d3449900caf1150093698d0b4373f1 /include/asm-h8300/uaccess.h
parentfb39380b8d683b55630ba5ba381f4e43e417420e (diff)
h8300: fix recent uaccess breakage
Al Viro wrote: > > After that commit in asm-h8300/uaccess.h we have > > #define get_user(x, ptr) \ > ({ \ > int __gu_err = 0; \ > uint32_t __gu_val = 0; \ > ^^^^^^^^^^^^^^^^^ > switch (sizeof(*(ptr))) { \ > case 1: \ > case 2: \ > case 4: \ > __gu_val = *(ptr); \ > break; \ > case 8: \ > memcpy(&__gu_val, ptr, sizeof (*(ptr))); \ > ^^^^^^^^^^^^^^^^ > > which, of course, is FUBAR whenever we actually hit that case - memcpy of > 8 bytes into uint32_t is obviously wrong. Why don't we simply do Cc: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-h8300/uaccess.h')
-rw-r--r--include/asm-h8300/uaccess.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/include/asm-h8300/uaccess.h b/include/asm-h8300/uaccess.h
index a22350ec271a..356068cd0879 100644
--- a/include/asm-h8300/uaccess.h
+++ b/include/asm-h8300/uaccess.h
@@ -91,22 +91,19 @@ extern int __put_user_bad(void);
91#define get_user(x, ptr) \ 91#define get_user(x, ptr) \
92({ \ 92({ \
93 int __gu_err = 0; \ 93 int __gu_err = 0; \
94 uint32_t __gu_val = 0; \ 94 typeof(*(ptr)) __gu_val = *ptr; \
95 switch (sizeof(*(ptr))) { \ 95 switch (sizeof(*(ptr))) { \
96 case 1: \ 96 case 1: \
97 case 2: \ 97 case 2: \
98 case 4: \ 98 case 4: \
99 __gu_val = *(ptr); \ 99 case 8: \
100 break; \
101 case 8: \
102 memcpy(&__gu_val, ptr, sizeof (*(ptr))); \
103 break; \ 100 break; \
104 default: \ 101 default: \
105 __gu_val = 0; \
106 __gu_err = __get_user_bad(); \ 102 __gu_err = __get_user_bad(); \
103 __gu_val = 0; \
107 break; \ 104 break; \
108 } \ 105 } \
109 (x) = (typeof(*(ptr)))__gu_val; \ 106 (x) = __gu_val; \
110 __gu_err; \ 107 __gu_err; \
111}) 108})
112#define __get_user(x, ptr) get_user(x, ptr) 109#define __get_user(x, ptr) get_user(x, ptr)