diff options
Diffstat (limited to 'arch/m32r')
| -rw-r--r-- | arch/m32r/include/asm/thread_info.h | 5 | ||||
| -rw-r--r-- | arch/m32r/include/asm/uaccess.h | 88 | ||||
| -rw-r--r-- | arch/m32r/kernel/signal.c | 2 |
3 files changed, 45 insertions, 50 deletions
diff --git a/arch/m32r/include/asm/thread_info.h b/arch/m32r/include/asm/thread_info.h index 00171703402f..32422d0211c3 100644 --- a/arch/m32r/include/asm/thread_info.h +++ b/arch/m32r/include/asm/thread_info.h | |||
| @@ -34,7 +34,6 @@ struct thread_info { | |||
| 34 | 0-0xBFFFFFFF for user-thread | 34 | 0-0xBFFFFFFF for user-thread |
| 35 | 0-0xFFFFFFFF for kernel-thread | 35 | 0-0xFFFFFFFF for kernel-thread |
| 36 | */ | 36 | */ |
| 37 | struct restart_block restart_block; | ||
| 38 | 37 | ||
| 39 | __u8 supervisor_stack[0]; | 38 | __u8 supervisor_stack[0]; |
| 40 | }; | 39 | }; |
| @@ -49,7 +48,6 @@ struct thread_info { | |||
| 49 | #define TI_CPU 0x00000010 | 48 | #define TI_CPU 0x00000010 |
| 50 | #define TI_PRE_COUNT 0x00000014 | 49 | #define TI_PRE_COUNT 0x00000014 |
| 51 | #define TI_ADDR_LIMIT 0x00000018 | 50 | #define TI_ADDR_LIMIT 0x00000018 |
| 52 | #define TI_RESTART_BLOCK 0x000001C | ||
| 53 | 51 | ||
| 54 | #endif | 52 | #endif |
| 55 | 53 | ||
| @@ -68,9 +66,6 @@ struct thread_info { | |||
| 68 | .cpu = 0, \ | 66 | .cpu = 0, \ |
| 69 | .preempt_count = INIT_PREEMPT_COUNT, \ | 67 | .preempt_count = INIT_PREEMPT_COUNT, \ |
| 70 | .addr_limit = KERNEL_DS, \ | 68 | .addr_limit = KERNEL_DS, \ |
| 71 | .restart_block = { \ | ||
| 72 | .fn = do_no_restart_syscall, \ | ||
| 73 | }, \ | ||
| 74 | } | 69 | } |
| 75 | 70 | ||
| 76 | #define init_thread_info (init_thread_union.thread_info) | 71 | #define init_thread_info (init_thread_union.thread_info) |
diff --git a/arch/m32r/include/asm/uaccess.h b/arch/m32r/include/asm/uaccess.h index 84fe7ba53035..71adff209405 100644 --- a/arch/m32r/include/asm/uaccess.h +++ b/arch/m32r/include/asm/uaccess.h | |||
| @@ -54,7 +54,7 @@ static inline void set_fs(mm_segment_t s) | |||
| 54 | 54 | ||
| 55 | #endif /* not CONFIG_MMU */ | 55 | #endif /* not CONFIG_MMU */ |
| 56 | 56 | ||
| 57 | #define segment_eq(a,b) ((a).seg == (b).seg) | 57 | #define segment_eq(a, b) ((a).seg == (b).seg) |
| 58 | 58 | ||
| 59 | #define __addr_ok(addr) \ | 59 | #define __addr_ok(addr) \ |
| 60 | ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg)) | 60 | ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg)) |
| @@ -68,7 +68,7 @@ static inline void set_fs(mm_segment_t s) | |||
| 68 | * | 68 | * |
| 69 | * This needs 33-bit arithmetic. We have a carry... | 69 | * This needs 33-bit arithmetic. We have a carry... |
| 70 | */ | 70 | */ |
| 71 | #define __range_ok(addr,size) ({ \ | 71 | #define __range_ok(addr, size) ({ \ |
| 72 | unsigned long flag, roksum; \ | 72 | unsigned long flag, roksum; \ |
| 73 | __chk_user_ptr(addr); \ | 73 | __chk_user_ptr(addr); \ |
| 74 | asm ( \ | 74 | asm ( \ |
| @@ -103,7 +103,7 @@ static inline void set_fs(mm_segment_t s) | |||
| 103 | * this function, memory access functions may still return -EFAULT. | 103 | * this function, memory access functions may still return -EFAULT. |
| 104 | */ | 104 | */ |
| 105 | #ifdef CONFIG_MMU | 105 | #ifdef CONFIG_MMU |
| 106 | #define access_ok(type,addr,size) (likely(__range_ok(addr,size) == 0)) | 106 | #define access_ok(type, addr, size) (likely(__range_ok(addr, size) == 0)) |
| 107 | #else | 107 | #else |
| 108 | static inline int access_ok(int type, const void *addr, unsigned long size) | 108 | static inline int access_ok(int type, const void *addr, unsigned long size) |
| 109 | { | 109 | { |
| @@ -167,8 +167,8 @@ extern int fixup_exception(struct pt_regs *regs); | |||
| 167 | * Returns zero on success, or -EFAULT on error. | 167 | * Returns zero on success, or -EFAULT on error. |
| 168 | * On error, the variable @x is set to zero. | 168 | * On error, the variable @x is set to zero. |
| 169 | */ | 169 | */ |
| 170 | #define get_user(x,ptr) \ | 170 | #define get_user(x, ptr) \ |
| 171 | __get_user_check((x),(ptr),sizeof(*(ptr))) | 171 | __get_user_check((x), (ptr), sizeof(*(ptr))) |
| 172 | 172 | ||
| 173 | /** | 173 | /** |
| 174 | * put_user: - Write a simple value into user space. | 174 | * put_user: - Write a simple value into user space. |
| @@ -186,8 +186,8 @@ extern int fixup_exception(struct pt_regs *regs); | |||
| 186 | * | 186 | * |
| 187 | * Returns zero on success, or -EFAULT on error. | 187 | * Returns zero on success, or -EFAULT on error. |
| 188 | */ | 188 | */ |
| 189 | #define put_user(x,ptr) \ | 189 | #define put_user(x, ptr) \ |
| 190 | __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) | 190 | __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) |
| 191 | 191 | ||
| 192 | /** | 192 | /** |
| 193 | * __get_user: - Get a simple variable from user space, with less checking. | 193 | * __get_user: - Get a simple variable from user space, with less checking. |
| @@ -209,41 +209,41 @@ extern int fixup_exception(struct pt_regs *regs); | |||
| 209 | * Returns zero on success, or -EFAULT on error. | 209 | * Returns zero on success, or -EFAULT on error. |
| 210 | * On error, the variable @x is set to zero. | 210 | * On error, the variable @x is set to zero. |
| 211 | */ | 211 | */ |
| 212 | #define __get_user(x,ptr) \ | 212 | #define __get_user(x, ptr) \ |
| 213 | __get_user_nocheck((x),(ptr),sizeof(*(ptr))) | 213 | __get_user_nocheck((x), (ptr), sizeof(*(ptr))) |
| 214 | 214 | ||
| 215 | #define __get_user_nocheck(x,ptr,size) \ | 215 | #define __get_user_nocheck(x, ptr, size) \ |
| 216 | ({ \ | 216 | ({ \ |
| 217 | long __gu_err = 0; \ | 217 | long __gu_err = 0; \ |
| 218 | unsigned long __gu_val; \ | 218 | unsigned long __gu_val; \ |
| 219 | might_fault(); \ | 219 | might_fault(); \ |
| 220 | __get_user_size(__gu_val,(ptr),(size),__gu_err); \ | 220 | __get_user_size(__gu_val, (ptr), (size), __gu_err); \ |
| 221 | (x) = (__typeof__(*(ptr)))__gu_val; \ | 221 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ |
| 222 | __gu_err; \ | 222 | __gu_err; \ |
| 223 | }) | 223 | }) |
| 224 | 224 | ||
| 225 | #define __get_user_check(x,ptr,size) \ | 225 | #define __get_user_check(x, ptr, size) \ |
| 226 | ({ \ | 226 | ({ \ |
| 227 | long __gu_err = -EFAULT; \ | 227 | long __gu_err = -EFAULT; \ |
| 228 | unsigned long __gu_val = 0; \ | 228 | unsigned long __gu_val = 0; \ |
| 229 | const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ | 229 | const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ |
| 230 | might_fault(); \ | 230 | might_fault(); \ |
| 231 | if (access_ok(VERIFY_READ,__gu_addr,size)) \ | 231 | if (access_ok(VERIFY_READ, __gu_addr, size)) \ |
| 232 | __get_user_size(__gu_val,__gu_addr,(size),__gu_err); \ | 232 | __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \ |
| 233 | (x) = (__typeof__(*(ptr)))__gu_val; \ | 233 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ |
| 234 | __gu_err; \ | 234 | __gu_err; \ |
| 235 | }) | 235 | }) |
| 236 | 236 | ||
| 237 | extern long __get_user_bad(void); | 237 | extern long __get_user_bad(void); |
| 238 | 238 | ||
| 239 | #define __get_user_size(x,ptr,size,retval) \ | 239 | #define __get_user_size(x, ptr, size, retval) \ |
| 240 | do { \ | 240 | do { \ |
| 241 | retval = 0; \ | 241 | retval = 0; \ |
| 242 | __chk_user_ptr(ptr); \ | 242 | __chk_user_ptr(ptr); \ |
| 243 | switch (size) { \ | 243 | switch (size) { \ |
| 244 | case 1: __get_user_asm(x,ptr,retval,"ub"); break; \ | 244 | case 1: __get_user_asm(x, ptr, retval, "ub"); break; \ |
| 245 | case 2: __get_user_asm(x,ptr,retval,"uh"); break; \ | 245 | case 2: __get_user_asm(x, ptr, retval, "uh"); break; \ |
| 246 | case 4: __get_user_asm(x,ptr,retval,""); break; \ | 246 | case 4: __get_user_asm(x, ptr, retval, ""); break; \ |
| 247 | default: (x) = __get_user_bad(); \ | 247 | default: (x) = __get_user_bad(); \ |
| 248 | } \ | 248 | } \ |
| 249 | } while (0) | 249 | } while (0) |
| @@ -288,26 +288,26 @@ do { \ | |||
| 288 | * | 288 | * |
| 289 | * Returns zero on success, or -EFAULT on error. | 289 | * Returns zero on success, or -EFAULT on error. |
| 290 | */ | 290 | */ |
| 291 | #define __put_user(x,ptr) \ | 291 | #define __put_user(x, ptr) \ |
| 292 | __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) | 292 | __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) |
| 293 | 293 | ||
| 294 | 294 | ||
| 295 | #define __put_user_nocheck(x,ptr,size) \ | 295 | #define __put_user_nocheck(x, ptr, size) \ |
| 296 | ({ \ | 296 | ({ \ |
| 297 | long __pu_err; \ | 297 | long __pu_err; \ |
| 298 | might_fault(); \ | 298 | might_fault(); \ |
| 299 | __put_user_size((x),(ptr),(size),__pu_err); \ | 299 | __put_user_size((x), (ptr), (size), __pu_err); \ |
| 300 | __pu_err; \ | 300 | __pu_err; \ |
| 301 | }) | 301 | }) |
| 302 | 302 | ||
| 303 | 303 | ||
| 304 | #define __put_user_check(x,ptr,size) \ | 304 | #define __put_user_check(x, ptr, size) \ |
| 305 | ({ \ | 305 | ({ \ |
| 306 | long __pu_err = -EFAULT; \ | 306 | long __pu_err = -EFAULT; \ |
| 307 | __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ | 307 | __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ |
| 308 | might_fault(); \ | 308 | might_fault(); \ |
| 309 | if (access_ok(VERIFY_WRITE,__pu_addr,size)) \ | 309 | if (access_ok(VERIFY_WRITE, __pu_addr, size)) \ |
| 310 | __put_user_size((x),__pu_addr,(size),__pu_err); \ | 310 | __put_user_size((x), __pu_addr, (size), __pu_err); \ |
| 311 | __pu_err; \ | 311 | __pu_err; \ |
| 312 | }) | 312 | }) |
| 313 | 313 | ||
| @@ -366,15 +366,15 @@ do { \ | |||
| 366 | 366 | ||
| 367 | extern void __put_user_bad(void); | 367 | extern void __put_user_bad(void); |
| 368 | 368 | ||
| 369 | #define __put_user_size(x,ptr,size,retval) \ | 369 | #define __put_user_size(x, ptr, size, retval) \ |
| 370 | do { \ | 370 | do { \ |
| 371 | retval = 0; \ | 371 | retval = 0; \ |
| 372 | __chk_user_ptr(ptr); \ | 372 | __chk_user_ptr(ptr); \ |
| 373 | switch (size) { \ | 373 | switch (size) { \ |
| 374 | case 1: __put_user_asm(x,ptr,retval,"b"); break; \ | 374 | case 1: __put_user_asm(x, ptr, retval, "b"); break; \ |
| 375 | case 2: __put_user_asm(x,ptr,retval,"h"); break; \ | 375 | case 2: __put_user_asm(x, ptr, retval, "h"); break; \ |
| 376 | case 4: __put_user_asm(x,ptr,retval,""); break; \ | 376 | case 4: __put_user_asm(x, ptr, retval, ""); break; \ |
| 377 | case 8: __put_user_u64((__typeof__(*ptr))(x),ptr,retval); break;\ | 377 | case 8: __put_user_u64((__typeof__(*ptr))(x), ptr, retval); break;\ |
| 378 | default: __put_user_bad(); \ | 378 | default: __put_user_bad(); \ |
| 379 | } \ | 379 | } \ |
| 380 | } while (0) | 380 | } while (0) |
| @@ -421,7 +421,7 @@ struct __large_struct { unsigned long buf[100]; }; | |||
| 421 | 421 | ||
| 422 | /* Generic arbitrary sized copy. */ | 422 | /* Generic arbitrary sized copy. */ |
| 423 | /* Return the number of bytes NOT copied. */ | 423 | /* Return the number of bytes NOT copied. */ |
| 424 | #define __copy_user(to,from,size) \ | 424 | #define __copy_user(to, from, size) \ |
| 425 | do { \ | 425 | do { \ |
| 426 | unsigned long __dst, __src, __c; \ | 426 | unsigned long __dst, __src, __c; \ |
| 427 | __asm__ __volatile__ ( \ | 427 | __asm__ __volatile__ ( \ |
| @@ -478,7 +478,7 @@ do { \ | |||
| 478 | : "r14", "memory"); \ | 478 | : "r14", "memory"); \ |
| 479 | } while (0) | 479 | } while (0) |
| 480 | 480 | ||
| 481 | #define __copy_user_zeroing(to,from,size) \ | 481 | #define __copy_user_zeroing(to, from, size) \ |
| 482 | do { \ | 482 | do { \ |
| 483 | unsigned long __dst, __src, __c; \ | 483 | unsigned long __dst, __src, __c; \ |
| 484 | __asm__ __volatile__ ( \ | 484 | __asm__ __volatile__ ( \ |
| @@ -548,14 +548,14 @@ do { \ | |||
| 548 | static inline unsigned long __generic_copy_from_user_nocheck(void *to, | 548 | static inline unsigned long __generic_copy_from_user_nocheck(void *to, |
| 549 | const void __user *from, unsigned long n) | 549 | const void __user *from, unsigned long n) |
| 550 | { | 550 | { |
| 551 | __copy_user_zeroing(to,from,n); | 551 | __copy_user_zeroing(to, from, n); |
| 552 | return n; | 552 | return n; |
| 553 | } | 553 | } |
| 554 | 554 | ||
| 555 | static inline unsigned long __generic_copy_to_user_nocheck(void __user *to, | 555 | static inline unsigned long __generic_copy_to_user_nocheck(void __user *to, |
| 556 | const void *from, unsigned long n) | 556 | const void *from, unsigned long n) |
| 557 | { | 557 | { |
| 558 | __copy_user(to,from,n); | 558 | __copy_user(to, from, n); |
| 559 | return n; | 559 | return n; |
| 560 | } | 560 | } |
| 561 | 561 | ||
| @@ -576,8 +576,8 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon | |||
| 576 | * Returns number of bytes that could not be copied. | 576 | * Returns number of bytes that could not be copied. |
| 577 | * On success, this will be zero. | 577 | * On success, this will be zero. |
| 578 | */ | 578 | */ |
| 579 | #define __copy_to_user(to,from,n) \ | 579 | #define __copy_to_user(to, from, n) \ |
| 580 | __generic_copy_to_user_nocheck((to),(from),(n)) | 580 | __generic_copy_to_user_nocheck((to), (from), (n)) |
| 581 | 581 | ||
| 582 | #define __copy_to_user_inatomic __copy_to_user | 582 | #define __copy_to_user_inatomic __copy_to_user |
| 583 | #define __copy_from_user_inatomic __copy_from_user | 583 | #define __copy_from_user_inatomic __copy_from_user |
| @@ -595,10 +595,10 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon | |||
| 595 | * Returns number of bytes that could not be copied. | 595 | * Returns number of bytes that could not be copied. |
| 596 | * On success, this will be zero. | 596 | * On success, this will be zero. |
| 597 | */ | 597 | */ |
| 598 | #define copy_to_user(to,from,n) \ | 598 | #define copy_to_user(to, from, n) \ |
| 599 | ({ \ | 599 | ({ \ |
| 600 | might_fault(); \ | 600 | might_fault(); \ |
| 601 | __generic_copy_to_user((to),(from),(n)); \ | 601 | __generic_copy_to_user((to), (from), (n)); \ |
| 602 | }) | 602 | }) |
| 603 | 603 | ||
| 604 | /** | 604 | /** |
| @@ -617,8 +617,8 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon | |||
| 617 | * If some data could not be copied, this function will pad the copied | 617 | * If some data could not be copied, this function will pad the copied |
| 618 | * data to the requested size using zero bytes. | 618 | * data to the requested size using zero bytes. |
| 619 | */ | 619 | */ |
| 620 | #define __copy_from_user(to,from,n) \ | 620 | #define __copy_from_user(to, from, n) \ |
| 621 | __generic_copy_from_user_nocheck((to),(from),(n)) | 621 | __generic_copy_from_user_nocheck((to), (from), (n)) |
| 622 | 622 | ||
| 623 | /** | 623 | /** |
| 624 | * copy_from_user: - Copy a block of data from user space. | 624 | * copy_from_user: - Copy a block of data from user space. |
| @@ -636,10 +636,10 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon | |||
| 636 | * If some data could not be copied, this function will pad the copied | 636 | * If some data could not be copied, this function will pad the copied |
| 637 | * data to the requested size using zero bytes. | 637 | * data to the requested size using zero bytes. |
| 638 | */ | 638 | */ |
| 639 | #define copy_from_user(to,from,n) \ | 639 | #define copy_from_user(to, from, n) \ |
| 640 | ({ \ | 640 | ({ \ |
| 641 | might_fault(); \ | 641 | might_fault(); \ |
| 642 | __generic_copy_from_user((to),(from),(n)); \ | 642 | __generic_copy_from_user((to), (from), (n)); \ |
| 643 | }) | 643 | }) |
| 644 | 644 | ||
| 645 | long __must_check strncpy_from_user(char *dst, const char __user *src, | 645 | long __must_check strncpy_from_user(char *dst, const char __user *src, |
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c index 95408b8f130a..7736c6660a15 100644 --- a/arch/m32r/kernel/signal.c +++ b/arch/m32r/kernel/signal.c | |||
| @@ -48,7 +48,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, | |||
| 48 | unsigned int err = 0; | 48 | unsigned int err = 0; |
| 49 | 49 | ||
| 50 | /* Always make any pending restarted system calls return -EINTR */ | 50 | /* Always make any pending restarted system calls return -EINTR */ |
| 51 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | 51 | current->restart_block.fn = do_no_restart_syscall; |
| 52 | 52 | ||
| 53 | #define COPY(x) err |= __get_user(regs->x, &sc->sc_##x) | 53 | #define COPY(x) err |= __get_user(regs->x, &sc->sc_##x) |
| 54 | COPY(r4); | 54 | COPY(r4); |
