Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 588bcce

Browse files
yunfei-mtkgregkh
authored andcommitted
media: mediatek: vcodec: Fix H264 multi stateless decoder smatch warning
[ Upstream commit 9be8549 ] Fix a smatch static checker warning on vdec_h264_req_multi_if.c. Which leads to a kernel crash when fb is NULL. Fixes: 397edc7 ("media: mediatek: vcodec: add h264 decoder driver for mt8186") Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 08d13bc commit 588bcce

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -724,11 +724,16 @@ static int vdec_h264_slice_single_decode(void *h_vdec, struct mtk_vcodec_mem *bs
724724
return vpu_dec_reset(vpu);
725725

726726
fb = inst->ctx->dev->vdec_pdata->get_cap_buffer(inst->ctx);
727+
if (!fb) {
728+
mtk_vdec_err(inst->ctx, "fb buffer is NULL");
729+
return -ENOMEM;
730+
}
731+
727732
src_buf_info = container_of(bs, struct mtk_video_dec_buf, bs_buffer);
728733
dst_buf_info = container_of(fb, struct mtk_video_dec_buf, frame_buffer);
729734

730-
y_fb_dma = fb ? (u64)fb->base_y.dma_addr : 0;
731-
c_fb_dma = fb ? (u64)fb->base_c.dma_addr : 0;
735+
y_fb_dma = fb->base_y.dma_addr;
736+
c_fb_dma = fb->base_c.dma_addr;
732737
mtk_vdec_debug(inst->ctx, "[h264-dec] [%d] y_dma=%llx c_dma=%llx",
733738
inst->ctx->decoded_frame_cnt, y_fb_dma, c_fb_dma);
734739

0 commit comments

Comments
 (0)