diff options
author | Andi Kleen <ak@suse.de> | 2006-09-26 04:52:40 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-09-26 04:52:40 -0400 |
commit | 26c13f2b5bbb03f798f8907db20296347e6c7ca6 (patch) | |
tree | 130d060354b40933fd819c8798759cac1cebe406 | |
parent | 758333458aa719bfc26ec16eafd4ad3a9e96014d (diff) |
[PATCH] Check return values of __copy_to_user in uname emulation
Quietens some new warnings
Signed-off-by: Andi Kleen <ak@suse.de>
-rw-r--r-- | arch/x86_64/ia32/sys_ia32.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c index 33cd0a4fe388..b0e82c7947dc 100644 --- a/arch/x86_64/ia32/sys_ia32.c +++ b/arch/x86_64/ia32/sys_ia32.c | |||
@@ -780,7 +780,7 @@ asmlinkage long sys32_mmap2(unsigned long addr, unsigned long len, | |||
780 | 780 | ||
781 | asmlinkage long sys32_olduname(struct oldold_utsname __user * name) | 781 | asmlinkage long sys32_olduname(struct oldold_utsname __user * name) |
782 | { | 782 | { |
783 | int error; | 783 | int err; |
784 | 784 | ||
785 | if (!name) | 785 | if (!name) |
786 | return -EFAULT; | 786 | return -EFAULT; |
@@ -789,27 +789,31 @@ asmlinkage long sys32_olduname(struct oldold_utsname __user * name) | |||
789 | 789 | ||
790 | down_read(&uts_sem); | 790 | down_read(&uts_sem); |
791 | 791 | ||
792 | error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); | 792 | err = __copy_to_user(&name->sysname,&system_utsname.sysname, |
793 | __put_user(0,name->sysname+__OLD_UTS_LEN); | 793 | __OLD_UTS_LEN); |
794 | __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN); | 794 | err |= __put_user(0,name->sysname+__OLD_UTS_LEN); |
795 | __put_user(0,name->nodename+__OLD_UTS_LEN); | 795 | err |= __copy_to_user(&name->nodename,&system_utsname.nodename, |
796 | __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN); | 796 | __OLD_UTS_LEN); |
797 | __put_user(0,name->release+__OLD_UTS_LEN); | 797 | err |= __put_user(0,name->nodename+__OLD_UTS_LEN); |
798 | __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); | 798 | err |= __copy_to_user(&name->release,&system_utsname.release, |
799 | __put_user(0,name->version+__OLD_UTS_LEN); | 799 | __OLD_UTS_LEN); |
800 | err |= __put_user(0,name->release+__OLD_UTS_LEN); | ||
801 | err |= __copy_to_user(&name->version,&system_utsname.version, | ||
802 | __OLD_UTS_LEN); | ||
803 | err |= __put_user(0,name->version+__OLD_UTS_LEN); | ||
800 | { | 804 | { |
801 | char *arch = "x86_64"; | 805 | char *arch = "x86_64"; |
802 | if (personality(current->personality) == PER_LINUX32) | 806 | if (personality(current->personality) == PER_LINUX32) |
803 | arch = "i686"; | 807 | arch = "i686"; |
804 | 808 | ||
805 | __copy_to_user(&name->machine,arch,strlen(arch)+1); | 809 | err |= __copy_to_user(&name->machine,arch,strlen(arch)+1); |
806 | } | 810 | } |
807 | 811 | ||
808 | up_read(&uts_sem); | 812 | up_read(&uts_sem); |
809 | 813 | ||
810 | error = error ? -EFAULT : 0; | 814 | err = err ? -EFAULT : 0; |
811 | 815 | ||
812 | return error; | 816 | return err; |
813 | } | 817 | } |
814 | 818 | ||
815 | long sys32_uname(struct old_utsname __user * name) | 819 | long sys32_uname(struct old_utsname __user * name) |