X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fsparc64%2Fkernel%2Fsys_sparc.c;h=ef419255c11ac0fd0df6350fbd755a8b17571262;hb=9464c7cf61b9433057924c36e6e02f303a00e768;hp=1abfb9c1e46d02a956429d23be0ab51efe9db57a;hpb=41689045f6a3cbe0550e1d34e9cc20d2e8c432ba;p=linux-2.6.git diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c index 1abfb9c1e..ef419255c 100644 --- a/arch/sparc64/kernel/sys_sparc.c +++ b/arch/sparc64/kernel/sys_sparc.c @@ -6,6 +6,7 @@ * platform. */ +#include #include #include #include @@ -706,23 +707,21 @@ extern void check_pending(int signum); asmlinkage long sys_getdomainname(char __user *name, int len) { - int nlen, err; - - if (len < 0) - return -EINVAL; + int nlen; + int err = -EFAULT; down_read(&uts_sem); nlen = strlen(vx_new_uts(domainname)) + 1; - err = -EINVAL; - if (nlen > len) - goto out; - err = -EFAULT; - if (!copy_to_user(name, vx_new_uts(domainname), nlen)) - err = 0; - -out: + if (nlen < len) + len = nlen; + if (len > __NEW_UTS_LEN) + goto done; + if (copy_to_user(name, vx_new_uts(domainname), len)) + goto done; + err = 0; +done: up_read(&uts_sem); return err; }