From: Ingo Oeser <ingo.oeser@informatik.tu-chemnitz.de>
To: Emmanuel Michon <emmanuel_michon@realmagic.fr>
Cc: linux-kernel@vger.kernel.org
Subject: Re: large copy_to_user fills only one page?
Date: Thu, 30 May 2002 17:25:44 +0200 [thread overview]
Message-ID: <20020530172544.I681@nightmaster.csn.tu-chemnitz.de> (raw)
In-Reply-To: <7wofexu2hl.fsf@avalon.france.sdesigns.com>
Hi Emmanuel,
On Thu, May 30, 2002 at 04:36:22PM +0200, Emmanuel Michon wrote:
> I'm working with linux-2.4.18, and writing some
> trivial code to get from kernel a grabbed image working this way:
> What I get actually is only 4K filled in userland, but copy_to_user
> returns IMSIZE!
copy_to_user() returns the number of bytes NOT copied.
same for copy_from_user().
This is a common mistake and your code using this functions should
look like this:
if (copy_from_user(to,uptr,size)) {
return -EFAULT;
}
/* Do some processing */
if (copy_to_user(uptr,from,size)) {
return -EFAULT;
}
PS: CC'ed linux-kernel, that you will not get 1000 answers ;-)
Regards
Ingo Oeser
--
Science is what we can tell a computer. Art is everything else. --- D.E.Knuth
prev parent reply other threads:[~2002-05-30 15:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-30 14:36 Emmanuel Michon
2002-05-30 15:16 ` Andi Kleen
2002-05-30 15:25 ` Ingo Oeser [this message]
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=20020530172544.I681@nightmaster.csn.tu-chemnitz.de \
--to=ingo.oeser@informatik.tu-chemnitz.de \
--cc=emmanuel_michon@realmagic.fr \
--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
all inboxes | Powered by JetHome®