Skip to contentSkip to conversation

drm/amdkfd: Fix for possible integer overflow

PATCH In review David Yat Sin 2 participants 2 messages Feb 18, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: Fix for possible integer overflow

Fix for possible integer overflow when doing addition.

---
 drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1 -1
index c3f252fc337b..6eca9509f2e3 100644
@@ -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;
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Am 2022-02-18 um 18:08 schrieb David Yat Sin:

Quoted 4 lines

Fix for possible integer overflow when doing addition.

Quoted 17 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1 -1
index c3f252fc337b..6eca9509f2e3 100644
@@ -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;