Commit a32e8adf authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Mauro Carvalho Chehab

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/83Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 961d3b27
...@@ -1126,7 +1126,7 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) ...@@ -1126,7 +1126,7 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
ret = -ENOMEM; ret = -ENOMEM;
/* initialize the test pattern generator */ /* initialize the test pattern generator */
tpg_init(&dev->tpg, 640, 360); 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; goto free_dev;
dev->scaled_line = vzalloc(array_size(MAX_WIDTH, MAX_ZOOM)); dev->scaled_line = vzalloc(array_size(MAX_WIDTH, MAX_ZOOM));
if (!dev->scaled_line) if (!dev->scaled_line)
...@@ -1136,7 +1136,7 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) ...@@ -1136,7 +1136,7 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
goto free_dev; goto free_dev;
/* load the edid */ /* load the edid */
dev->edid = vmalloc(256 * 128); dev->edid = vmalloc(array_size(256, 128));
if (!dev->edid) if (!dev->edid)
goto free_dev; goto free_dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment