diff options
author | Shivam Joshi <quic_shivamj@quicinc.com> | 2022-12-05 16:08:51 +0530 |
---|---|---|
committer | Shivam Joshi <quic_shivamj@quicinc.com> | 2023-03-09 10:58:34 +0530 |
commit | f79da997e86b208f7d8f24f57569881419b140c7 (patch) | |
tree | 4f39e27f016159717a5473b6a10a2cc00fb7bc5d | |
parent | 2a32c278d0fcc9c6fe8baa7888840a0458f4aebc (diff) | |
download | video-driver-f79da997e86b208f7d8f24f57569881419b140c7.tar.gz |
video: driver: Add check for valid initialization
Added check will ensure dereferencement of valid variable
Change-Id: Ia5a1a13f7ccb9a4771f16f7150718f983ecb4654
Signed-off-by: Shivam Joshi <quic_shivamj@quicinc.com>
-rw-r--r-- | driver/vidc/src/msm_vidc_memory.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/driver/vidc/src/msm_vidc_memory.c b/driver/vidc/src/msm_vidc_memory.c index 24f7a85..ef4a680 100644 --- a/driver/vidc/src/msm_vidc_memory.c +++ b/driver/vidc/src/msm_vidc_memory.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. - * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2020-2022, The Linux Foundation. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/dma-buf.h> @@ -380,6 +380,11 @@ int msm_vidc_memory_alloc(struct msm_vidc_core *core, struct msm_vidc_alloc *mem } heap = dma_heap_find(heap_name); + if (!heap) { + d_vpr_e("%s: No heap named %s\n", __func__, heap_name); + rc = -ENOMEM; + goto error; + } mem->dmabuf = dma_heap_buffer_alloc(heap, size, 0, 0); if (IS_ERR_OR_NULL(mem->dmabuf)) { d_vpr_e("%s: dma heap %s alloc failed\n", __func__, heap_name); |