diff options
author | Zhaowei Yuan <zhaowei.yuan@samsung.com> | 2014-08-21 23:28:21 -0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-10-05 13:41:10 -0700 |
commit | c5704583ad1f758b46ca91924634f97f731671a4 (patch) | |
tree | 463030a10bfb9b05bbacb7540e9f9fa4e4f6fc8e | |
parent | 0cc581bb13d8521f4f2f21f647ae5ab6bec060c1 (diff) | |
download | linux-stable-c5704583ad1f758b46ca91924634f97f731671a4.tar.gz linux-stable-c5704583ad1f758b46ca91924634f97f731671a4.tar.bz2 linux-stable-c5704583ad1f758b46ca91924634f97f731671a4.zip |
media: vb2: fix plane index sanity check in vb2_plane_cookie()
commit a9ae4692eda4b99f85757b15d60971ff78a0a0e2 upstream.
It's also invalid when plane_no is equal to vb->num_planes
Signed-off-by: Zhaowei Yuan <zhaowei.yuan@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 ca6c0710f39e..dcdceae30ab0 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1126,7 +1126,7 @@ EXPORT_SYMBOL_GPL(vb2_plane_vaddr); */ 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 call_ptr_memop(vb, cookie, vb->planes[plane_no].mem_priv); |