diff mbox series

media: videobuf2: Fix IS_ERR checking in vb2_vmalloc_put_userptr()

Message ID 20230924124425.3664024-1-make_ruc2021@163.com
State Superseded
Headers show
Series media: videobuf2: Fix IS_ERR checking in vb2_vmalloc_put_userptr() | expand

Commit Message

Ma Ke Sept. 24, 2023, 12:44 p.m. UTC
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@163.com>
---
 drivers/media/common/videobuf2/videobuf2-vmalloc.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

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 ||