summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2024-04-12 06:11:25 +1000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-13 12:50:17 +0200
commite6721ea845fcb93a764a92bd40f1afc0d6c69751 (patch)
treeeb80aad936111b6e7b2b740b1ab7e6c52cc45680
parent931e5381cb30355332f20854f80a0a1f18f6f1f1 (diff)
downloadlinux-stable-e6721ea845fcb93a764a92bd40f1afc0d6c69751.tar.gz
linux-stable-e6721ea845fcb93a764a92bd40f1afc0d6c69751.tar.bz2
linux-stable-e6721ea845fcb93a764a92bd40f1afc0d6c69751.zip
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: Dave Airlie <airlied@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_chardev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 297b36c26a05..840dfe8524e4 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -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;