LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: linuxppc-dev@ozlabs.org
Subject: Confused about usercopy_64.c
Date: Mon, 10 Mar 2008 11:38:49 -0500	[thread overview]
Message-ID: <47D56419.6000704@freescale.com> (raw)

I'm confused about something in usercopy_64.c:

unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
{
	if (likely(access_ok(VERIFY_READ, from, n)))
		n = __copy_from_user(to, from, n);
	else
		memset(to, 0, n);
	return n;
}

If access_ok() returns false, then that means that we cannot copy the data from
user-space.  So why are we returning 'n'?  Shouldn't we return zero, to let the
caller know that the function failed?

-- 
Timur Tabi
Linux kernel developer at Freescale

             reply	other threads:[~2008-03-10 16:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-10 16:38 Timur Tabi [this message]
2008-03-10 16:50 ` Confused about usercopy_64.c Olof Johansson
2008-03-10 16:53 ` Andreas Schwab

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=47D56419.6000704@freescale.com \
    --to=timur@freescale.com \
    --cc=linuxppc-dev@ozlabs.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