[lkml]   [2003]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Question on verify_area() and friends wrt
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.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:35    [W:0.093 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site