aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/sys_sparc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-18 19:15:40 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-18 19:15:40 -0400
commit20bf94e266969f91c623ed8b51da4109e3f57bcb (patch)
tree4aead8959e49802b454d9c650a86ee04ae94ad47 /arch/sparc64/kernel/sys_sparc.c
parent77e2782f9b683893c9341e9cf05c88b0caac7382 (diff)
parentb9c54f91a48146778fe91423d4d467a0ee8c719b (diff)
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/sparc64/kernel/sys_sparc.c')
-rw-r--r--arch/sparc64/kernel/sys_sparc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index bf5f14ee73de..c608c947e6c3 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)
707{ 707{
708 int nlen, err; 708 int nlen, err;
709 709
710 if (len < 0 || len > __NEW_UTS_LEN) 710 if (len < 0)
711 return -EINVAL; 711 return -EINVAL;
712 712
713 down_read(&uts_sem); 713 down_read(&uts_sem);
714 714
715 nlen = strlen(system_utsname.domainname) + 1; 715 nlen = strlen(system_utsname.domainname) + 1;
716 if (nlen < len) 716 err = -EINVAL;
717 len = nlen; 717 if (nlen > len)
718 goto out;
718 719
719 err = -EFAULT; 720 err = -EFAULT;
720 if (!copy_to_user(name, system_utsname.domainname, len)) 721 if (!copy_to_user(name, system_utsname.domainname, nlen))
721 err = 0; 722 err = 0;
722 723
724out:
723 up_read(&uts_sem); 725 up_read(&uts_sem);
724 return err; 726 return err;
725} 727}