diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2013-10-14 15:34:28 +0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-10-24 19:17:06 +0400 |
commit | f8544ec4f49ffb9cb93419e41f0d8c0fb39eb78f (patch) | |
tree | cebeb58b9e4ed050b88ef839438de3492cde5510 /arch/s390/kernel/signal.c | |
parent | f5be85a2d3b06e660d90dd672ae54015be3f62a9 (diff) | |
download | linux-f8544ec4f49ffb9cb93419e41f0d8c0fb39eb78f.tar.xz |
s390/compat,signal: change return values to -EFAULT
Instead of returnin the number of bytes not copied and/or -EFAULT let the
signal handler helper functions always return -EFAULT if a user space
access failed.
This doesn't fix a bug in the current code, but makes is harder to get it
wrong in the future.
Also "smatch" won't complain anymore about the fact that the number of
remaining bytes gets returned instead of -EFAULT.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/signal.c')
-rw-r--r-- | arch/s390/kernel/signal.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index b4fa7c0223e5..5c0ce019a8ae 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c @@ -70,21 +70,20 @@ static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs) save_fp_regs(¤t->thread.fp_regs); memcpy(&user_sregs.fpregs, ¤t->thread.fp_regs, sizeof(s390_fp_regs)); - return __copy_to_user(sregs, &user_sregs, sizeof(_sigregs)); + if (__copy_to_user(sregs, &user_sregs, sizeof(_sigregs))) + return -EFAULT; + return 0; } -/* Returns positive number on error */ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs) { - int err; _sigregs user_sregs; /* Alwys make any pending restarted system call return -EINTR */ current_thread_info()->restart_block.fn = do_no_restart_syscall; - err = __copy_from_user(&user_sregs, sregs, sizeof(_sigregs)); - if (err) - return err; + if (__copy_from_user(&user_sregs, sregs, sizeof(_sigregs))) + return -EFAULT; /* Use regs->psw.mask instead of PSW_USER_BITS to preserve PER bit. */ regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) | (user_sregs.regs.psw.mask & PSW_MASK_USER); |