public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: Dave Jones <davej@codemonkey.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: convert_fxsr_from_user
Date: Tue, 8 Apr 2003 16:51:13 -0700	[thread overview]
Message-ID: <20030408165113.3af2a32e.akpm@digeo.com> (raw)
In-Reply-To: <20030409001344.GA20353@suse.de>

Dave Jones <davej@codemonkey.org.uk> wrote:
>
> Andrew,
>  A while back you optimised this routine to not do lots of memory
> copies.  I've noticed it does no checking on the validity of the
> addresses it dereferences from userspace.

It never has performed those checks.   The check is in the caller,
arch/i386/kernel/signal.c:restore_i387.

Bless you for merging Jon's uaccess.h documentation patch. 

My __get_user()'s are arse-about.

diff -puN arch/i386/kernel/i387.c~convert_fxsr_from_user-get_user-fixes arch/i386/kernel/i387.c
--- 25/arch/i386/kernel/i387.c~convert_fxsr_from_user-get_user-fixes	Tue Apr  8 16:47:08 2003
+++ 25-akpm/arch/i386/kernel/i387.c	Tue Apr  8 16:48:13 2003
@@ -275,9 +275,9 @@ static int convert_fxsr_from_user( struc
 		unsigned long *t = (unsigned long *)to;
 		unsigned long *f = (unsigned long *)from;
 
-		if (__get_user(*f, t) ||
-				__get_user(*(f + 1), t + 1) ||
-				__get_user(from->exponent, &to->exponent))
+		if (__get_user(*t, f) ||
+				__get_user(*(t + 1), f + 1) ||
+				__get_user(to->exponent, &from->exponent))
 			return 1;
 	}
 	return 0;

_


  reply	other threads:[~2003-04-09  0:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-09  0:13 convert_fxsr_from_user Dave Jones
2003-04-08 23:51 ` Andrew Morton [this message]
2003-04-09  1:10   ` convert_fxsr_from_user Dave Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030408165113.3af2a32e.akpm@digeo.com \
    --to=akpm@digeo.com \
    --cc=davej@codemonkey.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox