aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
authorRicardo Ribalda <ribalda@chromium.org>2021-03-09 21:51:08 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-03-22 13:03:24 +0100
commit9cc25c4bea9e78e5f2d96977adede00a7dafb320 (patch)
tree3973eaf74279acd1f2dc03c00447ec5622082b5c /drivers/media/common
parentmedia: v4l2-ctrls: Fix h264 hierarchical coding type menu ctrl (diff)
downloadlinux-dev-9cc25c4bea9e78e5f2d96977adede00a7dafb320.tar.xz
linux-dev-9cc25c4bea9e78e5f2d96977adede00a7dafb320.zip
media: videobuf2: Exit promptly if size = 0
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> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/common')
-rw-r--r--drivers/media/common/videobuf2/videobuf2-dma-sg.c2
1 files changed, 1 insertions, 1 deletions
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);