Messages in this thread |  | | Date | Sun, 25 May 2003 13:07:06 +0100 | From | Christoph Hellwig <> | Subject | Re: 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |