media: chips-media: wave511: Fix null deference in wave5_vpu_dec_clr_disp_flag() 89/299689/1 accepted/tizen/unified/riscv/20231013.094029
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 6 Oct 2023 10:04:06 +0000 (19:04 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 6 Oct 2023 10:04:22 +0000 (19:04 +0900)
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 <sw0312.kim@samsung.com>
drivers/media/platform/chips-media/wave5/wave5-vpuapi.c

index 5a0078a..4e38a4d 100644 (file)
@@ -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;