Commit c5704583 authored by Zhaowei Yuan's avatar Zhaowei Yuan Committed by Greg Kroah-Hartman

media: vb2: fix plane index sanity check in vb2_plane_cookie()

commit a9ae4692 upstream.

It's also invalid when plane_no is equal to vb->num_planes
Signed-off-by: default avatarZhaowei Yuan <zhaowei.yuan@samsung.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0cc581bb
...@@ -1126,7 +1126,7 @@ EXPORT_SYMBOL_GPL(vb2_plane_vaddr); ...@@ -1126,7 +1126,7 @@ EXPORT_SYMBOL_GPL(vb2_plane_vaddr);
*/ */
void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no) void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no)
{ {
if (plane_no > vb->num_planes || !vb->planes[plane_no].mem_priv) if (plane_no >= vb->num_planes || !vb->planes[plane_no].mem_priv)
return NULL; return NULL;
return call_ptr_memop(vb, cookie, vb->planes[plane_no].mem_priv); return call_ptr_memop(vb, cookie, vb->planes[plane_no].mem_priv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment