drm/amdkfd: Add upper bound check for num_of_nodes
Subsystems (3)
PATCH 1/1 drm/amdkfd: Add upper bound check for num_of_nodes
drm/amdkfd: Add upper bound check for num_of_nodes in kfd_ioctl_get_process_apertures_new.
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +3 -0
@@ -776,6 +776,9 @@ static int kfd_ioctl_get_process_apertures_new(struct file *filp, goto out_unlock; } +if (args->num_of_nodes >NUM_OF_SUPPORTED_GPUS ) +return -EINVAL ; +/* Fill in process-aperture information for all available * nodes, but not more than args->num_of_nodes as that is * the amount of memory allocated by user
Signature · 1 line
2.34.1
[AMD Official Use Only - AMD Internal Distribution Only]
One comment below.
________________________________
From: Liu, Alysa <[email protected]>
Sent: Monday, March 30, 2026 10:57 AM
To: [email protected] <[email protected]>
Cc: Kasiviswanathan, Harish <[email protected]>; Liu, Alysa <[email protected]>
Subject: [PATCH] drm/amdkfd: Add upper bound check for num_of_nodes
drm/amdkfd: Add upper bound check for num_of_nodes in kfd_ioctl_get_process_apertures_new.
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +3 -0
@@ -776,6 +776,9 @@ static int kfd_ioctl_get_process_apertures_new(struct file *filp, goto out_unlock; } +if (args->num_of_nodes >NUM_OF_SUPPORTED_GPUS ) +return -EINVAL ; +
You should use p->n_pdds instead of NUM_OF_SUPPORTED_GPUS. Thanks.
/* Fill in process-aperture information for all available
* nodes, but not more than args->num_of_nodes as that is
* the amount of memory allocated by user
--
2.34.1