bail out in mathemu if __copy_to_user fails
PATCH 1/1 bail out in mathemu if __copy_to_user fails
I believe we should check the return value of__copy_to_user in math-emu/fpu_entry.c and bail out of save_i387_soft() if it fails.
This patch does that.
This also kills the warning :
arch/i386/math-emu/fpu_entry.c:745: warning: ignoring return value of `__copy_to_user', declared with attribute warn_unused_result
---
arch/i386/math-emu/fpu_entry.c +2 -1
@@ -742,7 +742,8 @@ #ifdef PECULIAR_486S387 ->fcs &= ~0xf8000000 ;S387 ->fos |=0xffff0000 ;#endif /* PECULIAR_486 */ -__copy_to_user (d, &S387 ->cwd,7 *4 ); +if (__copy_to_user (d, &S387 ->cwd,7 *4 )) +return -1 ;RE_ENTRANT_CHECK_ON ; d +=7 *4 ;
Quoted 7 lines · On Thu, 2 Nov 2006 00:03:16 +0100 Jesper Juhl wrote:
I believe we should check the return value of
__copy_to_userinmath-emu/fpu_entry.cand bail out ofsave_i387_soft()if it fails.
This patch does that.This also kills the warning :
arch/i386/math-emu/fpu_entry.c:745: warning: ignoring return value of `__copy_to_user', declared with attributewarn_unused_result
Quoted 8 lines
Signed-off-by Jesper Juhl <[email protected]>---
arch/i386/math-emu/fpu_entry.c +0
-0
arch/i386/math-emu/fpu_entry.c #ifdef PECULIAR_486 · line 749
Quoted 9 lines
arch/i386/math-emu/fpu_entry.c +2
-1@@ -742,7 +742,8 @@ #ifdef PECULIAR_486S387 ->fcs &= ~0xf8000000 ;S387 ->fos |=0xffff0000 ;#endif /* PECULIAR_486 */ -__copy_to_user (d, &S387 ->cwd,7 *4 ); +if (__copy_to_user (d, &S387 ->cwd,7 *4 )) +return -1 ;RE_ENTRANT_CHECK_ON ; d +=7 *4 ;
---
~Randy
Quoted 7 lines · Randy Dunlap
Quoted 5 lines · On Thu, 2 Nov 2006 00:03:16 +0100 Jesper Juhl wrote:
I believe we should check the return value of
__copy_to_userinmath-emu/fpu_entry.cand bail out ofsave_i387_soft()if it fails.
This patch does that.
Quoted 6 lines
Quoted 2 lines
This also kills the warning :
arch/i386/math-emu/fpu_entry.c:745: warning: ignoring return value of `__copy_to_user', declared with attributewarn_unused_result
Ohh. I was not aware of that patch. Let's apply yours, it's so much more thorough than mine :-)
Thank you for pointing it out.
Quoted 23 lines
Quoted 9 lines
Signed-off-by Jesper Juhl <[email protected]>---
arch/i386/math-emu/fpu_entry.c +0
-0arch/i386/math-emu/fpu_entry.c #ifdef PECULIAR_486 · line 749
Quoted 9 lines
arch/i386/math-emu/fpu_entry.c +2
-1@@ -742,7 +742,8 @@ #ifdef PECULIAR_486S387 ->fcs &= ~0xf8000000 ;S387 ->fos |=0xffff0000 ;#endif /* PECULIAR_486 */ -__copy_to_user (d, &S387 ->cwd,7 *4 ); +if (__copy_to_user (d, &S387 ->cwd,7 *4 )) +return -1 ;RE_ENTRANT_CHECK_ON ; d +=7 *4 ;---
~Randy
Signature · 3 lines
Jesper Juhl <[email protected]> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please http://www.expita.com/nomime.html