From: Xia Jiang Date: Fri, 14 Aug 2020 07:11:35 +0000 (+0200) Subject: media: platform: Improve queue set up flow for bug fixing X-Git-Tag: v5.15~2723^2~511 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5095a6413a0cf896ab468009b6142cb0fe617e66;p=platform%2Fkernel%2Flinux-starfive.git media: platform: Improve queue set up flow for bug fixing Add checking created buffer size follow in mtk_jpeg_queue_setup(). Reviewed-by: Tomasz Figa Signed-off-by: Xia Jiang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index d1b1355..93347ab 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -571,6 +571,13 @@ static int mtk_jpeg_queue_setup(struct vb2_queue *q, if (!q_data) return -EINVAL; + if (*num_planes) { + for (i = 0; i < *num_planes; i++) + if (sizes[i] < q_data->sizeimage[i]) + return -EINVAL; + return 0; + } + *num_planes = q_data->fmt->colplanes; for (i = 0; i < q_data->fmt->colplanes; i++) { sizes[i] = q_data->sizeimage[i];