[IA64] signal : fix missing error checkings
authorShi Weihua <shiwh@cn.fujitsu.com>
Mon, 3 Dec 2007 04:57:50 +0000 (12:57 +0800)
committerTony Luck <tony.luck@intel.com>
Sat, 8 Dec 2007 00:10:59 +0000 (16:10 -0800)
Not all the return value of __copy_from_user and
__put_user is checked.This patch fixed it.

Signed-off-by: Shi Weihua <shiwh@cn.fujitsu.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/ia64/kernel/signal.c

index cdb64cc4d9c85d93ad21b26756047d358387700a..4c730099d58fcbfae6140c4f523bf210426b733b 100644 (file)
@@ -98,7 +98,7 @@ restore_sigcontext (struct sigcontext __user *sc, struct sigscratch *scr)
        if ((flags & IA64_SC_FLAG_FPH_VALID) != 0) {
                struct ia64_psr *psr = ia64_psr(&scr->pt);
 
-               __copy_from_user(current->thread.fph, &sc->sc_fr[32], 96*16);
+               err |= __copy_from_user(current->thread.fph, &sc->sc_fr[32], 96*16);
                psr->mfh = 0;   /* drop signal handler's fph contents... */
                preempt_disable();
                if (psr->dfh)
@@ -244,7 +244,7 @@ static long
 setup_sigcontext (struct sigcontext __user *sc, sigset_t *mask, struct sigscratch *scr)
 {
        unsigned long flags = 0, ifs, cfm, nat;
-       long err;
+       long err = 0;
 
        ifs = scr->pt.cr_ifs;
 
@@ -257,12 +257,12 @@ setup_sigcontext (struct sigcontext __user *sc, sigset_t *mask, struct sigscratc
        ia64_flush_fph(current);
        if ((current->thread.flags & IA64_THREAD_FPH_VALID)) {
                flags |= IA64_SC_FLAG_FPH_VALID;
-               __copy_to_user(&sc->sc_fr[32], current->thread.fph, 96*16);
+               err = __copy_to_user(&sc->sc_fr[32], current->thread.fph, 96*16);
        }
 
        nat = ia64_get_scratch_nat_bits(&scr->pt, scr->scratch_unat);
 
-       err  = __put_user(flags, &sc->sc_flags);
+       err |= __put_user(flags, &sc->sc_flags);
        err |= __put_user(nat, &sc->sc_nat);
        err |= PUT_SIGSET(mask, &sc->sc_mask);
        err |= __put_user(cfm, &sc->sc_cfm);