diff mbox series

[v2] vcodec: mediatek: add check for NULL for

Message ID 20221102121027.4285-1-abelova@astralinux.ru (mailing list archive)
State New, archived
Headers show
Series [v2] vcodec: mediatek: add check for NULL for | expand

Commit Message

Anastasia Belova Nov. 2, 2022, 12:10 p.m. UTC
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@astralinux.ru>
---
 drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Nicolas Dufresne Nov. 3, 2022, 4:17 p.m. UTC | #1
Le mercredi 02 novembre 2022 à 15:10 +0300, Anastasia Belova a écrit :
> 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")

As Angelo said, this change is a no-op in practice, for this reason I would
suggest to drop the `Fixes` tag (not worth the effort of back-porting this).

> 
> Signed-off-by: Anastasia Belova <abelova@astralinux.ru>

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

> ---
>  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;
AngeloGioacchino Del Regno Nov. 4, 2022, 9:05 a.m. UTC | #2
Il 02/11/22 13:10, Anastasia Belova ha scritto:
> 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@astralinux.ru>

Hello Anastasia,

for some reason, you've got an incomplete commit title on this v2. Please fix.

Thanks,
Angelo
diff mbox series

Patch

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;