diff options
author | 2020-11-02 11:17:59 -0500 | |
---|---|---|
committer | 2020-11-02 15:33:33 -0500 | |
commit | 9d17df77bcfaef59e99586c4db8ef38b4bfe46ea (patch) | |
tree | 4d7cd44e6674d284a911f86af43db56c52493227 | |
parent | drm/amd/display: fix the NULL pointer that missed set_disp_pattern_generator callback (diff) | |
download | linux-dev-9d17df77bcfaef59e99586c4db8ef38b4bfe46ea.tar.xz linux-dev-9d17df77bcfaef59e99586c4db8ef38b4bfe46ea.zip |
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>
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c index cdd5032d5c0e..a0acf2310357 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c @@ -804,10 +804,10 @@ int kfd_create_crat_image_acpi(void **crat_image, size_t *size) } pcrat_image = kvmalloc(crat_table->length, GFP_KERNEL); - memcpy(pcrat_image, crat_table, crat_table->length); if (!pcrat_image) return -ENOMEM; + memcpy(pcrat_image, crat_table, crat_table->length); *crat_image = pcrat_image; *size = crat_table->length; |