Skip to content

Commit 0b17219

Browse files
airliedsmb49
authored andcommitted
amdkfd: use calloc instead of kzalloc to avoid integer overflow
BugLink: https://bugs.launchpad.net/bugs/2065805 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> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
1 parent 93241b8 commit 0b17219

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/amd/amdkfd/kfd_chardev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,8 +940,8 @@ static int kfd_ioctl_get_process_apertures_new(struct file *filp,
940940
* nodes, but not more than args->num_of_nodes as that is
941941
* the amount of memory allocated by user
942942
*/
943-
pa = kzalloc((sizeof(struct kfd_process_device_apertures) *
944-
args->num_of_nodes), GFP_KERNEL);
943+
pa = kcalloc(args->num_of_nodes, sizeof(struct kfd_process_device_apertures),
944+
GFP_KERNEL);
945945
if (!pa)
946946
return -ENOMEM;
947947

0 commit comments

Comments
 (0)