From: Christoph Hellwig <hch@infradead.org>
To: "Paulo Andre'" <l16083@alunos.uevora.pt>
Cc: kernel-janitor-discuss@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: Question on verify_area() and friends wrt
Date: Sun, 25 May 2003 13:07:06 +0100 [thread overview]
Message-ID: <20030525130706.B9127@infradead.org> (raw)
In-Reply-To: <20030525124625.4dedc758.l16083@alunos.uevora.pt>; from l16083@alunos.uevora.pt on Sun, May 25, 2003 at 12:46:25PM +0100
On Sun, May 25, 2003 at 12:46:25PM +0100, Paulo Andre' wrote:
> if (!verify_area(VERIFY_WRITE, ptr, sizeof(ir) +
> (sizeof(struct inquiry_info) * ir.num_rsp))) {
> copy_to_user(ptr, &ir, sizeof(ir));
> ptr += sizeof(ir);
> copy_to_user(ptr, buf, sizeof(struct inquiry_info) * ir.num_rsp); } else
> err = -EFAULT;
>
> I'm presuming verify_area() does its job fine returning 0 if the memory
> is valid and -EFAULT if not. Thus, given the exact check that's been
> done, there seems indeed to exist no need to check each call to
> copy_to_user() below. Or is there?
verify_area only does some checks so you need to check the return value
from copy_to_user. You could switch to __copy_to_user, though.
next prev parent reply other threads:[~2003-05-25 11:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-25 11:46 Paulo Andre'
2003-05-25 12:07 ` Christoph Hellwig [this message]
2003-05-25 13:53 ` Paulo Andre'
2003-05-24 22:46 ` dan carpenter
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=20030525130706.B9127@infradead.org \
--to=hch@infradead.org \
--cc=kernel-janitor-discuss@lists.sourceforge.net \
--cc=l16083@alunos.uevora.pt \
--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®