Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6721ea8 authored by Dave Airlie's avatar Dave Airlie Committed by Greg Kroah-Hartman
Browse files

amdkfd: use calloc instead of kzalloc to avoid integer overflow



commit 3b0daecfeac0103aba8b293df07a0cbaf8b43f29 upstream.

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>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 931e5381
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -923,8 +923,8 @@ static int kfd_ioctl_get_process_apertures_new(struct file *filp,
	 * nodes, but not more than args->num_of_nodes as that is
	 * the amount of memory allocated by user
	 */
	pa = kzalloc((sizeof(struct kfd_process_device_apertures) *
				args->num_of_nodes), GFP_KERNEL);
	pa = kcalloc(args->num_of_nodes, sizeof(struct kfd_process_device_apertures),
		     GFP_KERNEL);
	if (!pa)
		return -ENOMEM;