From: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
To: "Yunfei Dong (董云飞)" <Yunfei.Dong@mediatek.com>,
"nhebert@chromium.org" <nhebert@chromium.org>,
"benjamin.gaignard@collabora.com"
<benjamin.gaignard@collabora.com>,
"nfraprado@collabora.com" <nfraprado@collabora.com>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>,
"nicolas.dufresne@collabora.com" <nicolas.dufresne@collabora.com>,
"hverkuil-cisco@xs4all.nl" <hverkuil-cisco@xs4all.nl>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"frkoenig@chromium.org" <frkoenig@chromium.org>,
"stevecho@chromium.org" <stevecho@chromium.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"daniel@ffwll.ch" <daniel@ffwll.ch>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
"hsinyi@chromium.org" <hsinyi@chromium.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/3] media: mediatek: vcodec: fix h264 multi statless decoder smatch warning
Date: Wed, 29 May 2024 15:14:21 +0200 [thread overview]
Message-ID: <8a007787-c648-4ae3-829f-7a0b17dd9a89@collabora.com> (raw)
In-Reply-To: <9ba79ccf849054974a937d1d605910cf4c8552d6.camel@mediatek.com>
Hi,
W dniu 3.04.2024 o 05:45, Yunfei Dong (董云飞) pisze:
> Hi AngeloGioacchino,
>
> Thanks for your reviewing.
> On Tue, 2024-04-02 at 11:50 +0200, AngeloGioacchino Del Regno wrote:
>> Il 29/02/24 10:56, Yunfei Dong ha scritto:
>>> Fix smatch static checker warning for vdec_h264_req_multi_if.c.
>>> Leading to kernel crash when fb is NULL.
>>>
>>> Fixes: 397edc703a10 ("media: mediatek: vcodec: add h264 decoder")
>>> Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
>>> ---
>>> .../vcodec/decoder/vdec/vdec_h264_req_multi_if.c | 9
>>> +++++++--
>>> 1 file changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git
>>> a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req
>>> _multi_if.c
>>> b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req
>>> _multi_if.c
>>> index 0e741e0dc8ba..ab8e708e0df1 100644
>>> ---
>>> a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req
>>> _multi_if.c
>>> +++
>>> b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req
>>> _multi_if.c
>>> @@ -724,11 +724,16 @@ static int vdec_h264_slice_single_decode(void
>>> *h_vdec, struct mtk_vcodec_mem *bs
>>> return vpu_dec_reset(vpu);
>>>
>>> fb = inst->ctx->dev->vdec_pdata->get_cap_buffer(inst->ctx);
>>> + if (!fb) {
>>> + mtk_vdec_err(inst->ctx, "fb buffer is NULL");
>>> + return -EBUSY;
>>> + }
>>> +
>>> src_buf_info = container_of(bs, struct mtk_video_dec_buf,
>>> bs_buffer);
>>> dst_buf_info = container_of(fb, struct mtk_video_dec_buf,
>>> frame_buffer);
>>>
>>> - y_fb_dma = fb ? (u64)fb->base_y.dma_addr : 0;
>>> - c_fb_dma = fb ? (u64)fb->base_c.dma_addr : 0;
>>
>> You're changing the behavior here, can you please explain why this
>> change is valid
>> into the commit description?
>>
> The driver already add the condition to check whether fb is NULL at the
> front, no need these two lines again.
>
Maybe Angelo refers to the function never returning -EBUSY before?
While at it, if fb is a kind of a buffer, why not -ENOMEM
when get_cap_buffer() fails?
Regards,
Andrzej
>> Thanks,
>> Angelo
>>
> Best Regards,
> Yunfei Dong
>>> + y_fb_dma = (u64)fb->base_y.dma_addr;
>>> + c_fb_dma = (u64)fb->base_c.dma_addr;
>>> mtk_vdec_debug(inst->ctx, "[h264-dec] [%d] y_dma=%llx
>>> c_dma=%llx",
>>> inst->ctx->decoded_frame_cnt, y_fb_dma,
>>> c_fb_dma);
>>>
>>
>>
>>
next prev parent reply other threads:[~2024-05-29 13:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-29 9:56 [PATCH 0/3] media: mediatek: vcodec: fix vcodec smatch warning Yunfei Dong
2024-02-29 9:56 ` [PATCH 1/3] media: mediatek: vcodec: fix h264 multi statless decoder " Yunfei Dong
2024-04-02 9:50 ` AngeloGioacchino Del Regno
2024-04-03 3:45 ` Yunfei Dong (董云飞)
2024-05-29 13:14 ` Andrzej Pietrasiewicz [this message]
2024-06-13 9:28 ` Yunfei Dong (董云飞)
2024-02-29 9:56 ` [PATCH 2/3] media: mediatek: vcodec: fix vp8 stateless " Yunfei Dong
2024-02-29 9:56 ` [PATCH 3/3] media: mediatek: vcodec: fix h264 " Yunfei Dong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8a007787-c648-4ae3-829f-7a0b17dd9a89@collabora.com \
--to=andrzej.p@collabora.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=Yunfei.Dong@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=benjamin.gaignard@collabora.com \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=frkoenig@chromium.org \
--cc=hsinyi@chromium.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=nfraprado@collabora.com \
--cc=nhebert@chromium.org \
--cc=nicolas.dufresne@collabora.com \
--cc=stevecho@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox