Skip to content

Commit 3b0daec

Browse files
committed
amdkfd: use calloc instead of kzalloc to avoid integer overflow
This uses calloc instead of doing the multiplication which might overflow. Cc: [email protected] Signed-off-by: Dave Airlie <[email protected]>
1 parent 6d83727 commit 3b0daec

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
@@ -779,8 +779,8 @@ static int kfd_ioctl_get_process_apertures_new(struct file *filp,
779779
* nodes, but not more than args->num_of_nodes as that is
780780
* the amount of memory allocated by user
781781
*/
782-
pa = kzalloc((sizeof(struct kfd_process_device_apertures) *
783-
args->num_of_nodes), GFP_KERNEL);
782+
pa = kcalloc(args->num_of_nodes, sizeof(struct kfd_process_device_apertures),
783+
GFP_KERNEL);
784784
if (!pa)
785785
return -ENOMEM;
786786

0 commit comments

Comments
 (0)