* [PATCH] bail out in mathemu if __copy_to_user fails
@ 2006-11-01 23:03 Jesper Juhl
2006-11-01 23:14 ` Randy Dunlap
0 siblings, 1 reply; 3+ messages in thread
From: Jesper Juhl @ 2006-11-01 23:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Linus Torvalds, billm, Jesper Juhl
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
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---
diff --git a/arch/i386/math-emu/fpu_entry.c b/arch/i386/math-emu/fpu_entry.c
index d93f16e..ddf8fa3 100644
--- a/arch/i386/math-emu/fpu_entry.c
+++ b/arch/i386/math-emu/fpu_entry.c
@@ -742,7 +742,8 @@ #ifdef PECULIAR_486
S387->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;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bail out in mathemu if __copy_to_user fails
2006-11-01 23:03 [PATCH] bail out in mathemu if __copy_to_user fails Jesper Juhl
@ 2006-11-01 23:14 ` Randy Dunlap
2006-11-01 23:23 ` Jesper Juhl
0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2006-11-01 23:14 UTC (permalink / raw)
To: Jesper Juhl; +Cc: linux-kernel, Linus Torvalds, billm
On Thu, 2 Nov 2006 00:03:16 +0100 Jesper Juhl wrote:
> 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
http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.19-rc4/2.6.19-rc4-mm1/broken-out/x86_64-mm-i386-mathemu-must-check.patch
> Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
> ---
>
> diff --git a/arch/i386/math-emu/fpu_entry.c b/arch/i386/math-emu/fpu_entry.c
> index d93f16e..ddf8fa3 100644
> --- a/arch/i386/math-emu/fpu_entry.c
> +++ b/arch/i386/math-emu/fpu_entry.c
> @@ -742,7 +742,8 @@ #ifdef PECULIAR_486
> S387->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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bail out in mathemu if __copy_to_user fails
2006-11-01 23:14 ` Randy Dunlap
@ 2006-11-01 23:23 ` Jesper Juhl
0 siblings, 0 replies; 3+ messages in thread
From: Jesper Juhl @ 2006-11-01 23:23 UTC (permalink / raw)
To: Randy Dunlap; +Cc: linux-kernel, Linus Torvalds, billm
On 02/11/06, Randy Dunlap <randy.dunlap@oracle.com> wrote:
> On Thu, 2 Nov 2006 00:03:16 +0100 Jesper Juhl wrote:
>
> > 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
>
>
> http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.19-rc4/2.6.19-rc4-mm1/broken-out/x86_64-mm-i386-mathemu-must-check.patch
>
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.
>
> > Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
> > ---
> >
> > diff --git a/arch/i386/math-emu/fpu_entry.c b/arch/i386/math-emu/fpu_entry.c
> > index d93f16e..ddf8fa3 100644
> > --- a/arch/i386/math-emu/fpu_entry.c
> > +++ b/arch/i386/math-emu/fpu_entry.c
> > @@ -742,7 +742,8 @@ #ifdef PECULIAR_486
> > S387->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
>
--
Jesper Juhl <jesper.juhl@gmail.com>
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-11-01 23:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-01 23:03 [PATCH] bail out in mathemu if __copy_to_user fails Jesper Juhl
2006-11-01 23:14 ` Randy Dunlap
2006-11-01 23:23 ` Jesper Juhl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox