提交 dfa6f240 编写于 作者: G Guennadi Liakhovetski 提交者: Mauro Carvalho Chehab

media: uvcvideo: Fix .queue_setup() to check the number of planes

According to documentation of struct vb2_ops the .queue_setup() callback
should return an error if the number of planes parameter contains an
invalid value on input. Fix this instead of ignoring the value.
Signed-off-by: NGuennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Reviewed-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
上级 7e09f7d5
...@@ -82,9 +82,14 @@ static int uvc_queue_setup(struct vb2_queue *vq, ...@@ -82,9 +82,14 @@ static int uvc_queue_setup(struct vb2_queue *vq,
struct uvc_streaming *stream = uvc_queue_to_stream(queue); struct uvc_streaming *stream = uvc_queue_to_stream(queue);
unsigned size = stream->ctrl.dwMaxVideoFrameSize; unsigned size = stream->ctrl.dwMaxVideoFrameSize;
/* Make sure the image size is large enough. */ /*
* When called with plane sizes, validate them. The driver supports
* single planar formats only, and requires buffers to be large enough
* to store a complete frame.
*/
if (*nplanes) if (*nplanes)
return sizes[0] < size ? -EINVAL : 0; return *nplanes != 1 || sizes[0] < size ? -EINVAL : 0;
*nplanes = 1; *nplanes = 1;
sizes[0] = size; sizes[0] = size;
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册