瀏覽代碼

video: driver: fix kw issue of pointer NULL checking

Add NULL check to fix kw issue of possible NULL dereference

Change-Id: Ia2518b43a855831277981a662d10f24e122748ba
Signed-off-by: Chen Sun <[email protected]>
Chen Sun 2 年之前
父節點
當前提交
99fa31a0bb
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      driver/vidc/src/msm_vidc_memory_ext.c

+ 6 - 0
driver/vidc/src/msm_vidc_memory_ext.c

@@ -151,6 +151,12 @@ static int msm_vidc_memory_alloc_ext(struct msm_vidc_core *core, struct msm_vidc
 	}
 
 	heap = dma_heap_find(heap_name);
+	if (IS_ERR_OR_NULL(heap)) {
+		d_vpr_e("%s: dma heap %s find failed\n", __func__, heap_name);
+		heap = NULL;
+		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);