From d42faaa3ee0d046412273060995294f73b077fc6 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 6 Oct 2023 19:04:06 +0900 Subject: [PATCH] media: chips-media: wave511: Fix null deference in wave5_vpu_dec_clr_disp_flag() If wave5_vpu_dec_open() is not called before calling wave5_vpu_dec_clr_disp_flag(), there is null deference. Fix the null deference by checking codec_info. Change-Id: I1a4d9a75681df293e1f67dd4338c6f770d789223 Signed-off-by: Seung-Woo Kim --- drivers/media/platform/chips-media/wave5/wave5-vpuapi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.c b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.c index 5a0078a..4e38a4d 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.c @@ -625,10 +625,14 @@ err_out: int wave5_vpu_dec_clr_disp_flag(struct vpu_instance *inst, int index) { - struct dec_info *p_dec_info = &inst->codec_info->dec_info; + struct dec_info *p_dec_info; int ret = 0; struct vpu_device *vpu_dev = inst->dev; + if (!inst->codec_info) + return -EINVAL; + + p_dec_info = &inst->codec_info->dec_info; if (index >= p_dec_info->num_of_display_fbs) return -EINVAL; -- 2.7.4