Public This series is:
Reviewed-by: Yifan Zhang <[email protected]> -----Original Message----- From: amd-gfx <[email protected]> On Behalf Of Perry Yuan Sent: Friday, November 6, 2026 2:26 PM To: [email protected] Cc: Zhang, Yifan <[email protected]>; Yuan, Perry <[email protected]> Subject: [PATCH v2 2/2] drm/amdkfd: test copy_from_user() directly in kfd_criu_restore_svm() copy_from_user() returns the number of bytes not copied, not an errno. kfd_criu_restore_svm() stored that count in ret before overwriting it with -EFAULT. Test the return value directly so ret only ever holds an error code. v2: - split the original patch into two, one change per patch (Yifan) Signed-off-by: Perry Yuan <[email protected]> --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c index a571fda5c713..ea1a2cca6a06 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c @@ -4257,9 +4257,8 @@ int kfd_criu_restore_svm(struct kfd_process *p, return -ENOMEM; } - ret = copy_from_user(&criu_svm_md->data, user_priv_ptr + *priv_data_offset, - svm_priv_data_size); - if (ret) { + if (copy_from_user(&criu_svm_md->data, user_priv_ptr + *priv_data_offset, + svm_priv_data_size)) { ret = -EFAULT; goto exit; } -- 2.34.1
