Commit 3b0daecf authored by Dave Airlie's avatar Dave Airlie

amdkfd: use calloc instead of kzalloc to avoid integer overflow

This uses calloc instead of doing the multiplication which might
overflow.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 6d837271
...@@ -779,8 +779,8 @@ static int kfd_ioctl_get_process_apertures_new(struct file *filp, ...@@ -779,8 +779,8 @@ static int kfd_ioctl_get_process_apertures_new(struct file *filp,
* nodes, but not more than args->num_of_nodes as that is * nodes, but not more than args->num_of_nodes as that is
* the amount of memory allocated by user * the amount of memory allocated by user
*/ */
pa = kzalloc((sizeof(struct kfd_process_device_apertures) * pa = kcalloc(args->num_of_nodes, sizeof(struct kfd_process_device_apertures),
args->num_of_nodes), GFP_KERNEL); GFP_KERNEL);
if (!pa) if (!pa)
return -ENOMEM; return -ENOMEM;
......
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