From: "Randy.Dunlap" From: Eugene TEO --- arch/i386/kernel/i387.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff -puN arch/i386/kernel/i387.c~janitor-09-i387-usercopy-check arch/i386/kernel/i387.c --- 25/arch/i386/kernel/i387.c~janitor-09-i387-usercopy-check 2004-01-20 19:31:03.000000000 -0800 +++ 25-akpm/arch/i386/kernel/i387.c 2004-01-20 19:32:57.000000000 -0800 @@ -451,15 +451,18 @@ int get_fpxregs( struct user_fxsr_struct int set_fpxregs( struct task_struct *tsk, struct user_fxsr_struct __user *buf ) { + int ret = 0; + if ( cpu_has_fxsr ) { - __copy_from_user( &tsk->thread.i387.fxsave, buf, - sizeof(struct user_fxsr_struct) ); + if (__copy_from_user( &tsk->thread.i387.fxsave, buf, + sizeof(struct user_fxsr_struct) )) + ret = -EFAULT; /* mxcsr bit 6 and 31-16 must be zero for security reasons */ tsk->thread.i387.fxsave.mxcsr &= 0xffbf; - return 0; } else { - return -EIO; + ret = -EIO; } + return ret; } /* _