From: jsg Date: Mon, 15 Apr 2024 01:40:36 +0000 (+0000) Subject: amdkfd: use calloc instead of kzalloc to avoid integer overflow X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b492a60185cbbeaca4d897e03d274be0207d8a6f;p=openbsd amdkfd: use calloc instead of kzalloc to avoid integer overflow From Dave Airlie 315eb3c2df7e4cb18e3eacfa18a53a46f2bf0ef7 in linux-6.6.y/6.6.27 3b0daecfeac0103aba8b293df07a0cbaf8b43f29 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c b/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c index 29594b06405..4fbdc942cb4 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c @@ -778,8 +778,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;