Commit 4658bae8 authored by David S. Miller's avatar David S. Miller

Sparc: Fix copy_{to,from}_user return value handling.

parent 3da9cf28
......@@ -513,9 +513,9 @@ static int do_sys32_msgsnd (int first, int second, int third, void *uptr)
if (!p)
return -ENOMEM;
err = get_user (p->mtype, &up->mtype);
err |= __copy_from_user (p->mtext, &up->mtext, second);
if (err)
err = -EFAULT;
if (get_user (p->mtype, &up->mtype) ||
__copy_from_user (p->mtext, &up->mtext, second))
goto out;
old_fs = get_fs ();
set_fs (KERNEL_DS);
......@@ -2759,6 +2759,8 @@ sys32_rt_sigaction(int sig, struct sigaction32 *act, struct sigaction32 *oact,
ret |= __copy_to_user(&oact->sa_mask, &set32, sizeof(sigset_t32));
ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
ret |= __put_user((long)old_ka.sa.sa_restorer, &oact->sa_restorer);
if (ret)
ret = -EFAULT;
}
return ret;
......@@ -3494,7 +3496,7 @@ static int nfs_clnt32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
err |= copy_from_user(&karg->ca_client.cl_fhkey[0],
&arg32->ca32_client.cl32_fhkey[0],
NFSCLNT_KEYMAX);
return err;
return (err ? -EFAULT : 0);
}
static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
......@@ -3520,7 +3522,7 @@ static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
&arg32->ca32_export.ex32_anon_gid);
karg->ca_export.ex_anon_uid = high2lowuid(karg->ca_export.ex_anon_uid);
karg->ca_export.ex_anon_gid = high2lowgid(karg->ca_export.ex_anon_gid);
return err;
return (err ? -EFAULT : 0);
}
static int nfs_uud32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
......@@ -3568,7 +3570,7 @@ static int nfs_uud32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
err |= __get_user(karg->ca_umap.ug_gdimap[i],
&(((__kernel_gid_t32 *)A(uaddr))[i]));
return err;
return (err ? -EFAULT : 0);
}
static int nfs_getfh32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
......@@ -3585,7 +3587,7 @@ static int nfs_getfh32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32
&arg32->ca32_getfh.gf32_ino);
err |= __get_user(karg->ca_getfh.gf_version,
&arg32->ca32_getfh.gf32_version);
return err;
return (err ? -EFAULT : 0);
}
static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
......@@ -3601,7 +3603,7 @@ static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32
(NFS_MAXPATHLEN+1));
err |= __get_user(karg->ca_getfd.gd_version,
&arg32->ca32_getfd.gd32_version);
return err;
return (err ? -EFAULT : 0);
}
static int nfs_getfs32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
......@@ -3617,7 +3619,7 @@ static int nfs_getfs32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32
(NFS_MAXPATHLEN+1));
err |= __get_user(karg->ca_getfs.gd_maxlen,
&arg32->ca32_getfs.gd32_maxlen);
return err;
return (err ? -EFAULT : 0);
}
/* This really doesn't need translations, we are only passing
......@@ -3625,7 +3627,7 @@ static int nfs_getfs32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32
*/
static int nfs_getfh32_res_trans(union nfsctl_res *kres, union nfsctl_res32 *res32)
{
return copy_to_user(res32, kres, sizeof(*res32));
return (copy_to_user(res32, kres, sizeof(*res32)) ? -EFAULT : 0);
}
int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32)
......
......@@ -445,7 +445,7 @@ asmlinkage int sunos_uname(struct sunos_utsname *name)
ret |= copy_to_user(&name->ver[0], &system_utsname.version[0], sizeof(name->ver) - 1);
ret |= copy_to_user(&name->mach[0], &system_utsname.machine[0], sizeof(name->mach) - 1);
up_read(&uts_sem);
return ret;
return (ret ? -EFAULT : 0);
}
asmlinkage int sunos_nosys(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment