drm/amdkfd: Fix for possible integer overflow
authorDavid Yat Sin <david.yatsin@amd.com>
Fri, 18 Feb 2022 22:53:43 +0000 (17:53 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 23 Feb 2022 19:02:50 +0000 (14:02 -0500)
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>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c

index c3f252fc337b05194d7b050dec27f30afd0a4d65..6eca9509f2e38472bae67cb91bcac20696be1bb9 100644 (file)
@@ -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;