From: Seung-Woo Kim Date: Fri, 6 Oct 2023 10:04:06 +0000 (+0900) Subject: media: chips-media: wave511: Fix null deference in wave5_vpu_dec_clr_disp_flag() X-Git-Tag: accepted/tizen/unified/riscv/20231013.094029^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F89%2F299689%2F1;p=platform%2Fkernel%2Flinux-starfive.git 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 --- 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;