diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-10-30 10:17:15 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-10-30 10:16:46 -0400 |
commit | 3c52e49d7c81434e3d2ccb520b3a654c2cc7d03d (patch) | |
tree | fee9f3d92204f6081e39481df5bb2dc4b038d9ea /arch/s390 | |
parent | 5b479a79bff752c6719463f093bdd191f4b837db (diff) |
[S390] sparse: fix sparse warnings with __user pointers
Use __force to quiet sparse warnings about user address space.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/kernel/compat_signal.c | 23 | ||||
-rw-r--r-- | arch/s390/kernel/traps.c | 3 | ||||
-rw-r--r-- | arch/s390/lib/uaccess_pt.c | 6 |
3 files changed, 18 insertions, 14 deletions
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c index c68ea9c18046..4f68c81d3ffa 100644 --- a/arch/s390/kernel/compat_signal.c +++ b/arch/s390/kernel/compat_signal.c | |||
@@ -141,7 +141,8 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) | |||
141 | break; | 141 | break; |
142 | case __SI_FAULT >> 16: | 142 | case __SI_FAULT >> 16: |
143 | err |= __get_user(tmp, &from->si_addr); | 143 | err |= __get_user(tmp, &from->si_addr); |
144 | to->si_addr = (void __user *)(u64) (tmp & PSW32_ADDR_INSN); | 144 | to->si_addr = (void __force __user *) |
145 | (u64) (tmp & PSW32_ADDR_INSN); | ||
145 | break; | 146 | break; |
146 | case __SI_POLL >> 16: | 147 | case __SI_POLL >> 16: |
147 | err |= __get_user(to->si_band, &from->si_band); | 148 | err |= __get_user(to->si_band, &from->si_band); |
@@ -482,7 +483,7 @@ static int setup_frame32(int sig, struct k_sigaction *ka, | |||
482 | } else { | 483 | } else { |
483 | regs->gprs[14] = (__u64) frame->retcode | PSW32_ADDR_AMODE; | 484 | regs->gprs[14] = (__u64) frame->retcode | PSW32_ADDR_AMODE; |
484 | if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, | 485 | if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, |
485 | (u16 __user *)(frame->retcode))) | 486 | (u16 __force __user *)(frame->retcode))) |
486 | goto give_sigsegv; | 487 | goto give_sigsegv; |
487 | } | 488 | } |
488 | 489 | ||
@@ -491,12 +492,12 @@ static int setup_frame32(int sig, struct k_sigaction *ka, | |||
491 | goto give_sigsegv; | 492 | goto give_sigsegv; |
492 | 493 | ||
493 | /* Set up registers for signal handler */ | 494 | /* Set up registers for signal handler */ |
494 | regs->gprs[15] = (__u64) frame; | 495 | regs->gprs[15] = (__force __u64) frame; |
495 | regs->psw.mask |= PSW_MASK_BA; /* force amode 31 */ | 496 | regs->psw.mask |= PSW_MASK_BA; /* force amode 31 */ |
496 | regs->psw.addr = (__u64) ka->sa.sa_handler; | 497 | regs->psw.addr = (__force __u64) ka->sa.sa_handler; |
497 | 498 | ||
498 | regs->gprs[2] = map_signal(sig); | 499 | regs->gprs[2] = map_signal(sig); |
499 | regs->gprs[3] = (__u64) &frame->sc; | 500 | regs->gprs[3] = (__force __u64) &frame->sc; |
500 | 501 | ||
501 | /* We forgot to include these in the sigcontext. | 502 | /* We forgot to include these in the sigcontext. |
502 | To avoid breaking binary compatibility, they are passed as args. */ | 503 | To avoid breaking binary compatibility, they are passed as args. */ |
@@ -504,7 +505,7 @@ static int setup_frame32(int sig, struct k_sigaction *ka, | |||
504 | regs->gprs[5] = current->thread.prot_addr; | 505 | regs->gprs[5] = current->thread.prot_addr; |
505 | 506 | ||
506 | /* Place signal number on stack to allow backtrace from handler. */ | 507 | /* Place signal number on stack to allow backtrace from handler. */ |
507 | if (__put_user(regs->gprs[2], (int __user *) &frame->signo)) | 508 | if (__put_user(regs->gprs[2], (int __force __user *) &frame->signo)) |
508 | goto give_sigsegv; | 509 | goto give_sigsegv; |
509 | return 0; | 510 | return 0; |
510 | 511 | ||
@@ -547,21 +548,21 @@ static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
547 | } else { | 548 | } else { |
548 | regs->gprs[14] = (__u64) frame->retcode; | 549 | regs->gprs[14] = (__u64) frame->retcode; |
549 | err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, | 550 | err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, |
550 | (u16 __user *)(frame->retcode)); | 551 | (u16 __force __user *)(frame->retcode)); |
551 | } | 552 | } |
552 | 553 | ||
553 | /* Set up backchain. */ | 554 | /* Set up backchain. */ |
554 | if (__put_user(regs->gprs[15], (unsigned int __user *) frame)) | 555 | if (__put_user(regs->gprs[15], (unsigned int __force __user *) frame)) |
555 | goto give_sigsegv; | 556 | goto give_sigsegv; |
556 | 557 | ||
557 | /* Set up registers for signal handler */ | 558 | /* Set up registers for signal handler */ |
558 | regs->gprs[15] = (__u64) frame; | 559 | regs->gprs[15] = (__force __u64) frame; |
559 | regs->psw.mask |= PSW_MASK_BA; /* force amode 31 */ | 560 | regs->psw.mask |= PSW_MASK_BA; /* force amode 31 */ |
560 | regs->psw.addr = (__u64) ka->sa.sa_handler; | 561 | regs->psw.addr = (__u64) ka->sa.sa_handler; |
561 | 562 | ||
562 | regs->gprs[2] = map_signal(sig); | 563 | regs->gprs[2] = map_signal(sig); |
563 | regs->gprs[3] = (__u64) &frame->info; | 564 | regs->gprs[3] = (__force __u64) &frame->info; |
564 | regs->gprs[4] = (__u64) &frame->uc; | 565 | regs->gprs[4] = (__force __u64) &frame->uc; |
565 | return 0; | 566 | return 0; |
566 | 567 | ||
567 | give_sigsegv: | 568 | give_sigsegv: |
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index 79eee3f27afb..a9807dd86276 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c | |||
@@ -334,7 +334,8 @@ void __kprobes do_per_trap(struct pt_regs *regs) | |||
334 | info.si_signo = SIGTRAP; | 334 | info.si_signo = SIGTRAP; |
335 | info.si_errno = 0; | 335 | info.si_errno = 0; |
336 | info.si_code = TRAP_HWBKPT; | 336 | info.si_code = TRAP_HWBKPT; |
337 | info.si_addr = (void *) current->thread.per_event.address; | 337 | info.si_addr = |
338 | (void __force __user *) current->thread.per_event.address; | ||
338 | force_sig_info(SIGTRAP, &info, current); | 339 | force_sig_info(SIGTRAP, &info, current); |
339 | } | 340 | } |
340 | 341 | ||
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c index 74833831417f..342ae35a5ba9 100644 --- a/arch/s390/lib/uaccess_pt.c +++ b/arch/s390/lib/uaccess_pt.c | |||
@@ -342,7 +342,8 @@ int futex_atomic_op_pt(int op, u32 __user *uaddr, int oparg, int *old) | |||
342 | if (segment_eq(get_fs(), KERNEL_DS)) | 342 | if (segment_eq(get_fs(), KERNEL_DS)) |
343 | return __futex_atomic_op_pt(op, uaddr, oparg, old); | 343 | return __futex_atomic_op_pt(op, uaddr, oparg, old); |
344 | spin_lock(¤t->mm->page_table_lock); | 344 | spin_lock(¤t->mm->page_table_lock); |
345 | uaddr = (int __user *) __dat_user_addr((unsigned long) uaddr); | 345 | uaddr = (u32 __force __user *) |
346 | __dat_user_addr((__force unsigned long) uaddr); | ||
346 | if (!uaddr) { | 347 | if (!uaddr) { |
347 | spin_unlock(¤t->mm->page_table_lock); | 348 | spin_unlock(¤t->mm->page_table_lock); |
348 | return -EFAULT; | 349 | return -EFAULT; |
@@ -378,7 +379,8 @@ int futex_atomic_cmpxchg_pt(u32 *uval, u32 __user *uaddr, | |||
378 | if (segment_eq(get_fs(), KERNEL_DS)) | 379 | if (segment_eq(get_fs(), KERNEL_DS)) |
379 | return __futex_atomic_cmpxchg_pt(uval, uaddr, oldval, newval); | 380 | return __futex_atomic_cmpxchg_pt(uval, uaddr, oldval, newval); |
380 | spin_lock(¤t->mm->page_table_lock); | 381 | spin_lock(¤t->mm->page_table_lock); |
381 | uaddr = (int __user *) __dat_user_addr((unsigned long) uaddr); | 382 | uaddr = (u32 __force __user *) |
383 | __dat_user_addr((__force unsigned long) uaddr); | ||
382 | if (!uaddr) { | 384 | if (!uaddr) { |
383 | spin_unlock(¤t->mm->page_table_lock); | 385 | spin_unlock(¤t->mm->page_table_lock); |
384 | return -EFAULT; | 386 | return -EFAULT; |