diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-07-21 14:12:39 -0700 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-07-21 14:18:27 -0700 |
commit | 8310a32c15c76623bbe2425d38688a9d5b3e50a9 (patch) | |
tree | 47e565ab0f2d04abb32ac8a0a1f0753616fc0607 /arch/sparc64/kernel/sys_sparc.c | |
parent | 8a84eb164cc44a7604a27f8118473a82b45472a8 (diff) |
[SPARC]: Fix length parameter verification in sys_getdomainname().
Found by scrashme.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/sys_sparc.c')
-rw-r--r-- | arch/sparc64/kernel/sys_sparc.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c index 51c056df528e..054d0abdb7ee 100644 --- a/arch/sparc64/kernel/sys_sparc.c +++ b/arch/sparc64/kernel/sys_sparc.c @@ -701,21 +701,21 @@ extern void check_pending(int signum); asmlinkage long sys_getdomainname(char __user *name, int len) { - int nlen; - int err = -EFAULT; + int nlen, err; + + if (len < 0 || len > __NEW_UTS_LEN) + return -EINVAL; down_read(&uts_sem); nlen = strlen(system_utsname.domainname) + 1; - if (nlen < len) len = nlen; - if (len > __NEW_UTS_LEN) - goto done; - if (copy_to_user(name, system_utsname.domainname, len)) - goto done; - err = 0; -done: + + err = -EFAULT; + if (!copy_to_user(name, system_utsname.domainname, len)) + err = 0; + up_read(&uts_sem); return err; } |