linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Andries.Brouwer@cwi.nl
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] autofs sparse fixes
Date: Tue, 30 Sep 2003 16:54:50 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.44.0309301649470.21089-100000@home.osdl.org> (raw)
In-Reply-To: <UTC200309291825.h8TIPB318380.aeb@smtp.cwi.nl>


On Mon, 29 Sep 2003 Andries.Brouwer@cwi.nl wrote:
> 
> I think I prefer two rights above two wrongs - the declaration
> already gives addr the right type - it really does point to kernel space -
> but we inherit an incorrect type for file->f_op->write, so have to cast
> that.

No, the type for file->f_op->write is of the _rigth_ type.

It literally _does_ get the data from user space.

The thing is, what "set_fs(KERNEL_DS)" does is to say "kernel space is now 
user space". So the _caller_ will have made user space and kernel space be 
the same mapping, exactly so that the write will do the right thing.

[ Yeah, we long since renamed all the "get_fs_byte()" calls to a much more
  natural "get_user()" macro, and the "set_fs()" thing should be renamed
  too. It obviously makes no sense any more, since we don't use the '%fs'
  segment register even on x86 these days, and on other architectures it
  never made any sense in the first place. ]

So as a result of the "set_fs()" the kernel pointer literally _becomes_ a 
user-pointer. That's what set_fs() is all about. And that's why it is 
correct to cast the pointer - but not the function. The function still 
takes a user pointer.

			Linus


  reply	other threads:[~2003-09-30 23:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-29 18:25 [PATCH] autofs sparse fixes Andries.Brouwer
2003-09-30 23:54 ` Linus Torvalds [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-09-28 23:25 Andries.Brouwer
2003-09-29 16:44 ` Linus Torvalds

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=Pine.LNX.4.44.0309301649470.21089-100000@home.osdl.org \
    --to=torvalds@osdl.org \
    --cc=Andries.Brouwer@cwi.nl \
    --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;
as well as URLs for NNTP newsgroup(s).