lkml.org 
[lkml]   [2020]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.4 041/214] media: platform: Improve queue set up flow for bug fixing
    Date
    From: Xia Jiang <xia.jiang@mediatek.com>

    [ Upstream commit 5095a6413a0cf896ab468009b6142cb0fe617e66 ]

    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>
    ---
    drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 7 +++++++
    1 file changed, 7 insertions(+)

    diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
    index ee802fc3bcdfc..9fa1bc5514f3e 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];
    --
    2.27.0


    \
     
     \ /
      Last update: 2020-11-03 22:44    [W:6.531 / U:0.072 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site