diff mbox series

drm/amdkfd: Fix for possible integer overflow

Message ID 20220218230835.9914-1-david.yatsin@amd.com (mailing list archive)
State New, archived
Headers show
Series drm/amdkfd: Fix for possible integer overflow | expand

Commit Message

David Yat Sin Feb. 18, 2022, 11:08 p.m. UTC
Fix for possible integer overflow when doing addition.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David Yat Sin <david.yatsin@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Felix Kuehling Feb. 18, 2022, 11:23 p.m. UTC | #1
Am 2022-02-18 um 18:08 schrieb David Yat Sin:
> Fix for possible integer overflow when doing addition.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: David Yat Sin <david.yatsin@amd.com>

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>


> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> index c3f252fc337b..6eca9509f2e3 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
> @@ -786,7 +786,7 @@ int kfd_criu_restore_queue(struct kfd_process *p,
>   	}
>   
>   	*priv_data_offset += sizeof(*q_data);
> -	q_extra_data_size = q_data->ctl_stack_size + q_data->mqd_size;
> +	q_extra_data_size = (uint64_t)q_data->ctl_stack_size + q_data->mqd_size;
>   
>   	if (*priv_data_offset + q_extra_data_size > max_priv_data_size) {
>   		ret = -EINVAL;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
index c3f252fc337b..6eca9509f2e3 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
@@ -786,7 +786,7 @@  int kfd_criu_restore_queue(struct kfd_process *p,
 	}
 
 	*priv_data_offset += sizeof(*q_data);
-	q_extra_data_size = q_data->ctl_stack_size + q_data->mqd_size;
+	q_extra_data_size = (uint64_t)q_data->ctl_stack_size + q_data->mqd_size;
 
 	if (*priv_data_offset + q_extra_data_size > max_priv_data_size) {
 		ret = -EINVAL;