[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230924124425.3664024-1-make_ruc2021@163.com>
Date: Sun, 24 Sep 2023 20:44:25 +0800
From: Ma Ke <make_ruc2021@....com>
To: tfiga@...omium.org, m.szyprowski@...sung.com, mchehab@...nel.org
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Ma Ke <make_ruc2021@....com>
Subject: [PATCH] media: videobuf2: Fix IS_ERR checking in vb2_vmalloc_put_userptr()
In order to avoid error pointers from frame_vector_pages(), we could
use IS_ERR() to check the return value to fix this. This checking
operation could make sure that vector contains pages.
Signed-off-by: Ma Ke <make_ruc2021@....com>
---
drivers/media/common/videobuf2/videobuf2-vmalloc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/common/videobuf2/videobuf2-vmalloc.c b/drivers/media/common/videobuf2/videobuf2-vmalloc.c
index 7c635e292106..c37775080aff 100644
--- a/drivers/media/common/videobuf2/videobuf2-vmalloc.c
+++ b/drivers/media/common/videobuf2/videobuf2-vmalloc.c
@@ -134,6 +134,7 @@ static void vb2_vmalloc_put_userptr(void *buf_priv)
if (!buf->vec->is_pfns) {
n_pages = frame_vector_count(buf->vec);
pages = frame_vector_pages(buf->vec);
+ BUG_ON(IS_ERR(pages));
if (vaddr)
vm_unmap_ram((void *)vaddr, n_pages);
if (buf->dma_dir == DMA_FROM_DEVICE ||
--
2.37.2
Powered by blists - more mailing lists