* [PATCH] videobuf2-core: make checking condition more strict
@ 2014-08-20 3:11 Zhaowei Yuan
2014-08-20 9:26 ` Sylwester Nawrocki
0 siblings, 1 reply; 2+ messages in thread
From: Zhaowei Yuan @ 2014-08-20 3:11 UTC (permalink / raw)
To: linux-media, k.debski, m.chehab, kyungmin.park, jtp.park
Cc: linux-samsung-soc, hverkuil
It's also invalid that plane_no equals to vb->num_planes
Signed-off-by: Zhaowei Yuan <zhaowei.yuan@samsung.com>
---
drivers/media/v4l2-core/videobuf2-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index c359006..1ae4e57 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);
*/
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);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] videobuf2-core: make checking condition more strict
2014-08-20 3:11 [PATCH] videobuf2-core: make checking condition more strict Zhaowei Yuan
@ 2014-08-20 9:26 ` Sylwester Nawrocki
0 siblings, 0 replies; 2+ messages in thread
From: Sylwester Nawrocki @ 2014-08-20 9:26 UTC (permalink / raw)
To: Zhaowei Yuan, jtp.park
Cc: linux-media, k.debski, m.chehab, kyungmin.park, linux-samsung-soc,
hverkuil
On 20/08/14 05:11, Zhaowei Yuan wrote:
> It's also invalid that plane_no equals to vb->num_planes
The patch looks good to me but I would make the summary line more
specific, e.g. "vb2: fix plane index sanity check in vb2_plane_cookie()".
I think this patch should be backported to the stable trees.
> Signed-off-by: Zhaowei Yuan <zhaowei.yuan@samsung.com>
> ---
> drivers/media/v4l2-core/videobuf2-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
> index c359006..1ae4e57 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);
> */
> 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);
> --
> 1.7.9.5
--
Regards,
Sylwester
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-20 9:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-20 3:11 [PATCH] videobuf2-core: make checking condition more strict Zhaowei Yuan
2014-08-20 9:26 ` Sylwester Nawrocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).