summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeung-Woo Kim <sw0312.kim@samsung.com>2023-10-06 19:04:06 +0900
committerSeung-Woo Kim <sw0312.kim@samsung.com>2023-10-06 19:04:22 +0900
commitd42faaa3ee0d046412273060995294f73b077fc6 (patch)
treefc0e84e0ca17aec6b09c8aaffab32d3731acc49d
parent08f25a8ce13ded477f699bb5018b3cfa08180da5 (diff)
downloadlinux-starfive-d42faaa3ee0d046412273060995294f73b077fc6.tar.gz
linux-starfive-d42faaa3ee0d046412273060995294f73b077fc6.tar.bz2
linux-starfive-d42faaa3ee0d046412273060995294f73b077fc6.zip
media: chips-media: wave511: Fix null deference in wave5_vpu_dec_clr_disp_flag()accepted/tizen/unified/riscv/20231013.094029
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>
-rw-r--r--drivers/media/platform/chips-media/wave5/wave5-vpuapi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.c b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.c
index 5a0078a0d174..4e38a4d713e9 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;