mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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>
This commit is contained in:
parent
a2404fd482
commit
2e3a57f490
1 changed files with 1 additions and 1 deletions
|
@ -798,10 +798,10 @@ int kfd_create_crat_image_acpi(void **crat_image, size_t *size)
|
||||||
}
|
}
|
||||||
|
|
||||||
pcrat_image = kvmalloc(crat_table->length, GFP_KERNEL);
|
pcrat_image = kvmalloc(crat_table->length, GFP_KERNEL);
|
||||||
memcpy(pcrat_image, crat_table, crat_table->length);
|
|
||||||
if (!pcrat_image)
|
if (!pcrat_image)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
memcpy(pcrat_image, crat_table, crat_table->length);
|
||||||
*crat_image = pcrat_image;
|
*crat_image = pcrat_image;
|
||||||
*size = crat_table->length;
|
*size = crat_table->length;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue