Skip to content

Commit 2e3a57f

Browse files
kentrussellalexdeucher
authored andcommitted
amdkfd: Check kvmalloc return before memcpy
If we can't kvmalloc the pcrat_image, then we shouldn't memcpy Signed-off-by: Kent Russell <kent.russell@amd.com> Reported-by: kernel test robot <lkp@intel.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent a2404fd commit 2e3a57f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpu/drm/amd/amdkfd/kfd_crat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,10 +798,10 @@ int kfd_create_crat_image_acpi(void **crat_image, size_t *size)
798798
}
799799

800800
pcrat_image = kvmalloc(crat_table->length, GFP_KERNEL);
801-
memcpy(pcrat_image, crat_table, crat_table->length);
802801
if (!pcrat_image)
803802
return -ENOMEM;
804803

804+
memcpy(pcrat_image, crat_table, crat_table->length);
805805
*crat_image = pcrat_image;
806806
*size = crat_table->length;
807807

0 commit comments

Comments
 (0)