diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-18 16:15:40 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-18 16:15:40 -0700 |
commit | 20bf94e266969f91c623ed8b51da4109e3f57bcb (patch) | |
tree | 4aead8959e49802b454d9c650a86ee04ae94ad47 /arch | |
parent | 77e2782f9b683893c9341e9cf05c88b0caac7382 (diff) | |
parent | b9c54f91a48146778fe91423d4d467a0ee8c719b (diff) | |
download | linux-3.10-20bf94e266969f91c623ed8b51da4109e3f57bcb.tar.gz linux-3.10-20bf94e266969f91c623ed8b51da4109e3f57bcb.tar.bz2 linux-3.10-20bf94e266969f91c623ed8b51da4109e3f57bcb.zip |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
[SPARC]: Fix regression in sys_getdomainname()
[OPENPROMIO]: Handle current_node being NULL correctly.
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sparc/kernel/sys_sparc.c | 10 | ||||
-rw-r--r-- | arch/sparc64/kernel/sys_sparc.c | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c index 94ff58c9d4a..896863fb208 100644 --- a/arch/sparc/kernel/sys_sparc.c +++ b/arch/sparc/kernel/sys_sparc.c @@ -470,19 +470,21 @@ asmlinkage int sys_getdomainname(char __user *name, int len) { int nlen, err; - if (len < 0 || len > __NEW_UTS_LEN) + if (len < 0) return -EINVAL; down_read(&uts_sem); nlen = strlen(system_utsname.domainname) + 1; - if (nlen < len) - len = nlen; + err = -EINVAL; + if (nlen > len) + goto out; err = -EFAULT; - if (!copy_to_user(name, system_utsname.domainname, len)) + if (!copy_to_user(name, system_utsname.domainname, nlen)) err = 0; +out: up_read(&uts_sem); return err; } diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c index bf5f14ee73d..c608c947e6c 100644 --- a/arch/sparc64/kernel/sys_sparc.c +++ b/arch/sparc64/kernel/sys_sparc.c @@ -707,19 +707,21 @@ asmlinkage long sys_getdomainname(char __user *name, int len) { int nlen, err; - if (len < 0 || len > __NEW_UTS_LEN) + if (len < 0) return -EINVAL; down_read(&uts_sem); nlen = strlen(system_utsname.domainname) + 1; - if (nlen < len) - len = nlen; + err = -EINVAL; + if (nlen > len) + goto out; err = -EFAULT; - if (!copy_to_user(name, system_utsname.domainname, len)) + if (!copy_to_user(name, system_utsname.domainname, nlen)) err = 0; +out: up_read(&uts_sem); return err; } |