[PATCH v3] vcodec: mediatek: add check for NULL for vsi->frm_bufs[vsi->new_fb_idx].buf.fb in vp9_swap_frm_bufs

Anastasia Belova abelova at astralinux.ru
Fri Nov 11 01:06:04 PST 2022


Any time calling vp9_is_sf_ref_fb we need fb != NULL after checks.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: f77e89854b3e ("[media] vcodec: mediatek: Add Mediatek VP9 Video Decoder Driver")

Signed-off-by: Anastasia Belova <abelova at astralinux.ru>
---
 drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c
index 70b8383f7c8e..776468cd834a 100644
--- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c
+++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c
@@ -208,6 +208,9 @@ static bool vp9_is_sf_ref_fb(struct vdec_vp9_inst *inst, struct vdec_fb *fb)
 	int i;
 	struct vdec_vp9_vsi *vsi = inst->vsi;
 
+	if (!fb)
+		return true;
+
 	for (i = 0; i < ARRAY_SIZE(vsi->sf_ref_fb); i++) {
 		if (fb == &vsi->sf_ref_fb[i].fb)
 			return true;
-- 
2.30.2




More information about the Linux-mediatek mailing list