From c794d353c5a8c8d1b16fc0295f87a694bb5574d3 Mon Sep 17 00:00:00 2001 From: "xueman.ruan" Date: Fri, 28 Apr 2023 14:28:10 +0800 Subject: [PATCH] [allocator_dma_heap]: add file permission check. Change-Id: Icfffaf3594f029b87e3a87f17de408a681c49dfb Signed-off-by: xueman.ruan --- osal/allocator/allocator_dma_heap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osal/allocator/allocator_dma_heap.c b/osal/allocator/allocator_dma_heap.c index b981d449..d3e59cad 100644 --- a/osal/allocator/allocator_dma_heap.c +++ b/osal/allocator/allocator_dma_heap.c @@ -132,7 +132,10 @@ static int heap_fd_open(DmaHeapType type) int fd; snprintf(name, sizeof(name) - 1, "%s%s", heap_path, heap_names[type]); - fd = open(name, O_RDONLY | O_CLOEXEC); // read authority is enough + fd = open(name, O_RDONLY | O_CLOEXEC); // read permission is enough + if (fd <= 0) + mpp_err("dma-heap open %s %s\n", name, strerror(errno)); + mpp_assert(fd > 0); dma_heap_dbg(DMA_HEAP_DEVICE, "open dma heap dev %s fd %d\n", name, fd);