mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-26 22:24:09 +08:00
[media] DaVinci-VPBE: Use kmalloc_array() in vpbe_initialize()
* A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kmalloc_array". This issue was detected by using the Coccinelle software. * Replace the specification of a data type by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
e44e9489a7
commit
f42afd29e6
@ -676,9 +676,9 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)
|
||||
* store venc sd index.
|
||||
*/
|
||||
num_encoders = vpbe_dev->cfg->num_ext_encoders + 1;
|
||||
vpbe_dev->encoders = kmalloc(
|
||||
sizeof(struct v4l2_subdev *)*num_encoders,
|
||||
GFP_KERNEL);
|
||||
vpbe_dev->encoders = kmalloc_array(num_encoders,
|
||||
sizeof(*vpbe_dev->encoders),
|
||||
GFP_KERNEL);
|
||||
if (NULL == vpbe_dev->encoders) {
|
||||
v4l2_err(&vpbe_dev->v4l2_dev,
|
||||
"unable to allocate memory for encoders sub devices");
|
||||
|
Loading…
Reference in New Issue
Block a user