On Wednesday 27 June 2012 12:37:21 Hans Verkuil wrote: > On Wed 27 June 2012 11:52:10 Laurent Pinchart wrote: > > On Friday 22 June 2012 14:21:17 Hans Verkuil wrote: > > > From: Hans Verkuil <hans.verkuil@xxxxxxxxx> > > > > > > Split off the memory and type validation. This is done both from reqbufs > > > and create_bufs, and will also be done by vb2 helpers in a later patch. > > > > > > Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx> [snip] > > > + > > > +/** > > > + * vb2_reqbufs() - Wrapper for __reqbufs() that also verifies the > > > memory and > > > + * type values. > > > + * @q: videobuf2 queue > > > + * @create: creation parameters, passed from userspace to > > > vidioc_create_bufs > > > + * handler in driver > > > + */ > > > +int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers > > > *create) > > > +{ > > > + int ret = __verify_memory_type(q, create->memory, > > > create->format.type); > > > + > > > + create->index = q->num_buffers; > > > > I think this changes the behaviour of create_bufs, it should thus belong > > to the next patch. > > No, I don't think this changes the behavior as far as I can tell. Without your patch create->index isn't modified if the checks fail. On the other hand, I've just remembered that video_usercopy won't copy the structure back to userspace if ret < 0, so you should be right. > > > + return ret ? ret : __create_bufs(q, create); > > > +} > > > > > > EXPORT_SYMBOL_GPL(vb2_create_bufs); > > > > > > /** -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html