aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo A. R. Silva <[email protected]>2020-06-15 23:40:15 +0200
committerMauro Carvalho Chehab <[email protected]>2020-07-04 12:42:19 +0200
commita32e8adf2fdbd4fd1d046769140a8afd0489fe65 (patch)
tree5438510147ce71f5795908e20203e71046384a6f
parent961d3b27a2aff52dda0b97d35085a743a27c2f46 (diff)
media: test_drivers: vivid-core: Use array_size() helper
The tpg_alloc() and vmalloc() functions have no 2-factor argument form, so multiplication factors need to be wrapped in array_size(). This issue was found with the help of Coccinelle and, audited and fixed manually. Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83 Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
-rw-r--r--drivers/media/test-drivers/vivid/vivid-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c
index 5c986df4a8d4..f7ee37e9508d 100644
--- a/drivers/media/test-drivers/vivid/vivid-core.c
+++ b/drivers/media/test-drivers/vivid/vivid-core.c
@@ -1126,7 +1126,7 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
ret = -ENOMEM;
/* initialize the test pattern generator */
tpg_init(&dev->tpg, 640, 360);
- if (tpg_alloc(&dev->tpg, MAX_ZOOM * MAX_WIDTH))
+ if (tpg_alloc(&dev->tpg, array_size(MAX_WIDTH, MAX_ZOOM)))
goto free_dev;
dev->scaled_line = vzalloc(array_size(MAX_WIDTH, MAX_ZOOM));
if (!dev->scaled_line)
@@ -1136,7 +1136,7 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
goto free_dev;
/* load the edid */
- dev->edid = vmalloc(256 * 128);
+ dev->edid = vmalloc(array_size(256, 128));
if (!dev->edid)
goto free_dev;