Commit bd6040b0 authored by Atul Raut's avatar Atul Raut Committed by Alex Deucher
Browse files

drm/amdkfd: Use memdup_user() rather than duplicating its implementation



To prevent its redundant implementation and streamline
code, use memdup_user.

This fixes warnings reported by Coccinelle:
./drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c:2811:13-20: WARNING opportunity for memdup_user

Signed-off-by: default avatarAtul Raut <rauji.raut@gmail.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 8b3a7a70
Loading
Loading
Loading
Loading
+1 −9
Original line number Original line Diff line number Diff line
@@ -2817,19 +2817,11 @@ static void copy_context_work_handler (struct work_struct *work)
static uint32_t *get_queue_ids(uint32_t num_queues, uint32_t *usr_queue_id_array)
static uint32_t *get_queue_ids(uint32_t num_queues, uint32_t *usr_queue_id_array)
{
{
	size_t array_size = num_queues * sizeof(uint32_t);
	size_t array_size = num_queues * sizeof(uint32_t);
	uint32_t *queue_ids = NULL;


	if (!usr_queue_id_array)
	if (!usr_queue_id_array)
		return NULL;
		return NULL;


	queue_ids = kzalloc(array_size, GFP_KERNEL);
	return memdup_user(usr_queue_id_array, array_size);
	if (!queue_ids)
		return ERR_PTR(-ENOMEM);

	if (copy_from_user(queue_ids, usr_queue_id_array, array_size))
		return ERR_PTR(-EFAULT);

	return queue_ids;
}
}


int resume_queues(struct kfd_process *p,
int resume_queues(struct kfd_process *p,