lkml.org 
[lkml]   [2021]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] media: videobuf2: Exit promptly if size = 0
Date
Exit as soon as possible if a driver wants to allocate a buffer of
size 0, and print a warning to help fixing the issue.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/common/videobuf2/videobuf2-dma-sg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
index 030e48218687..c5b06a509566 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
@@ -105,7 +105,7 @@ static void *vb2_dma_sg_alloc(struct device *dev, unsigned long dma_attrs,
int ret;
int num_pages;

- if (WARN_ON(!dev))
+ if (WARN_ON(!dev) || WARN_ON(!size))
return ERR_PTR(-EINVAL);

buf = kzalloc(sizeof *buf, GFP_KERNEL);
--
2.30.1.766.gb4fecdf3b7-goog
\
 
 \ /
  Last update: 2021-03-09 21:52    [W:0.108 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site