public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Cc: Reinette Chatre <reinette.chatre@linux.intel.com>,
	Joe Korty <joe.korty@ccur.com>, Paul Jackson <pj@sgi.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bitmap: separate bitmap parsing for user buffer and kernel buffer
Date: Wed, 4 Oct 2006 18:57:47 -0700	[thread overview]
Message-ID: <20061004185747.4cb64048.akpm@osdl.org> (raw)
In-Reply-To: <200610041833.40866.inaky@linux.intel.com>

On Wed, 4 Oct 2006 18:33:37 -0700
Inaky Perez-Gonzalez <inaky@linux.intel.com> wrote:

> On Wednesday 04 October 2006 18:10, Andrew Morton wrote:
> > On Wed, 4 Oct 2006 17:56:30 -0700
> > Reinette Chatre <reinette.chatre@linux.intel.com> wrote:
> > > +			if (is_user) {
> > > +				if (__get_user(c, buf++))
> > > +					return -EFAULT;
> > > +			}
> > > +			else
> > > +				c = *buf++;
> >
> > Is this actually needed?  __get_user(kernel_address) works OK and (believe
> > it or not, given all the stuff it involves) boils down to a single
> > instruction.
> 
> We weren't too sure if that'd be true in all kinds of arches and
> memory models. If it works for kernel space too, then we can fold
> out a lot of code...

We use __get_user() in this fashion in several places in core kernel
already, although it's usually to find out "will this address give me a
fault", rather than to actually read a value.

There's some precedent for the `is_user' approach as well - it has the
advantage of being more sparse-friendly, and perhaps clearer to read.

  reply	other threads:[~2006-10-05  1:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-05  0:56 [PATCH] bitmap: separate bitmap parsing for user buffer and kernel buffer Reinette Chatre
2006-10-05  1:10 ` Andrew Morton
2006-10-05  1:33   ` Inaky Perez-Gonzalez
2006-10-05  1:57     ` Andrew Morton [this message]
2006-10-05 19:49       ` [PATCH] bitmap: parse kernel and user buffers Reinette Chatre
2006-10-05 21:48         ` [PATCH] bitmap: parse input from " Reinette Chatre
2006-10-05 22:32           ` Inaky Perez-Gonzalez
2006-10-05  1:40   ` [PATCH] bitmap: separate bitmap parsing for user buffer and kernel buffer H. Peter Anvin
2006-10-05 19:57   ` Andi Kleen
2006-10-05 20:38     ` Andrew Morton

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=20061004185747.4cb64048.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=inaky@linux.intel.com \
    --cc=joe.korty@ccur.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pj@sgi.com \
    --cc=reinette.chatre@linux.intel.com \
    /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