summaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel
diff options
context:
space:
mode:
authorAndy Walker <andy@puszczka.com>2006-09-18 07:11:36 -0700
committerDavid S. Miller <davem@davemloft.net>2006-09-18 07:11:36 -0700
commitb9c54f91a48146778fe91423d4d467a0ee8c719b (patch)
treef123be6ee2fb44b5795a3aa6f0ccbc8e9ea19d2b /arch/sparc/kernel
parentb9b64e6e89fc5a6ef220747115c5b7764614ca3f (diff)
downloadop-kernel-dev-b9c54f91a48146778fe91423d4d467a0ee8c719b.zip
op-kernel-dev-b9c54f91a48146778fe91423d4d467a0ee8c719b.tar.gz
[SPARC]: Fix regression in sys_getdomainname()
This patch corrects the buffer length checking in the sys_getdomainname() implementation for sparc/sparc64. Signed-off-by: Andy Walker <andy@puszczka.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel')
-rw-r--r--arch/sparc/kernel/sys_sparc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c
index 94ff58c..896863f 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;
}
OpenPOWER on IntegriCloud