Skip to content

Commit

Permalink
media: platform: Improve queue set up flow for bug fixing
Browse files Browse the repository at this point in the history
[ Upstream commit 5095a64 ]

Add checking created buffer size follow in mtk_jpeg_queue_setup().

Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Xia Jiang authored and gregkh committed Nov 5, 2020
1 parent 3a85688 commit 5472c5d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
Expand Up @@ -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];
Expand Down

0 comments on commit 5472c5d

Please sign in to comment.