diff mbox series

[1/2] media: venus: dec: Handle the case where find_format fails

Message ID 20220726021455.1814096-2-bryan.odonoghue@linaro.org (mailing list archive)
State New, archived
Headers show
Series media: venus: Fix up buffer handling for HFI_VERSION_1XX | expand

Commit Message

Bryan O'Donoghue July 26, 2022, 2:14 a.m. UTC
Debugging the decoder on msm8916 I noticed the vdec probe was crashing if
the fmt pointer was NULL.

A similar fix from Colin Ian King found by Coverity was implemented for the
encoder. Implement the same fix on the decoder.

Fixes: 7472c1c69138 ("[media] media: venus: vdec: add video decoder files")
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/media/platform/qcom/venus/vdec.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Stanimir Varbanov Aug. 5, 2022, 1:12 p.m. UTC | #1
Hi Bryan,

You forgot to CC: stable.

On 7/26/22 05:14, Bryan O'Donoghue wrote:
> Debugging the decoder on msm8916 I noticed the vdec probe was crashing if
> the fmt pointer was NULL.
> 
> A similar fix from Colin Ian King found by Coverity was implemented for the
> encoder. Implement the same fix on the decoder.
> 
> Fixes: 7472c1c69138 ("[media] media: venus: vdec: add video decoder files")

Cc: stable@vger.kernel.org  # v4.13+

> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  drivers/media/platform/qcom/venus/vdec.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
> index ac0bb45d07f4b..4ceaba37e2e57 100644
> --- a/drivers/media/platform/qcom/venus/vdec.c
> +++ b/drivers/media/platform/qcom/venus/vdec.c
> @@ -183,6 +183,8 @@ vdec_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f)
>  		else
>  			return NULL;
>  		fmt = find_format(inst, pixmp->pixelformat, f->type);
> +		if (!fmt)
> +			return NULL;
>  	}
>  
>  	pixmp->width = clamp(pixmp->width, frame_width_min(inst),
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index ac0bb45d07f4b..4ceaba37e2e57 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -183,6 +183,8 @@  vdec_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f)
 		else
 			return NULL;
 		fmt = find_format(inst, pixmp->pixelformat, f->type);
+		if (!fmt)
+			return NULL;
 	}
 
 	pixmp->width = clamp(pixmp->width, frame_width_min(inst),