diff options
author | Zhaowei Yuan <zhaowei.yuan@samsung.com> | 2014-08-21 22:28:21 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-09-21 19:50:21 -0400 |
commit | a9ae4692eda4b99f85757b15d60971ff78a0a0e2 (patch) | |
tree | b5f857083f955314babeec0d11ead1ba89bf79ad | |
parent | 983ed755641cfeac99716311f3d3b464d742f304 (diff) |
[media] vb2: fix plane index sanity check in vb2_plane_cookie()
It's also invalid when plane_no is equal to vb->num_planes
Signed-off-by: Zhaowei Yuan <zhaowei.yuan@samsung.com>
Cc: stable@vger.kernel.org # for v3.7 and up
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/v4l2-core/videobuf2-core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 7f70fd521ab1..c2126d874549 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c | |||
@@ -1130,7 +1130,7 @@ EXPORT_SYMBOL_GPL(vb2_plane_vaddr); | |||
1130 | */ | 1130 | */ |
1131 | void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no) | 1131 | void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no) |
1132 | { | 1132 | { |
1133 | if (plane_no > vb->num_planes || !vb->planes[plane_no].mem_priv) | 1133 | if (plane_no >= vb->num_planes || !vb->planes[plane_no].mem_priv) |
1134 | return NULL; | 1134 | return NULL; |
1135 | 1135 | ||
1136 | return call_ptr_memop(vb, cookie, vb->planes[plane_no].mem_priv); | 1136 | return call_ptr_memop(vb, cookie, vb->planes[plane_no].mem_priv); |