diff options
author | 2023-06-22 17:35:09 +0200 | |
---|---|---|
committer | 2023-06-22 17:35:10 +0200 | |
commit | 3f711c249032fee954e92e4d04c8cd2744994291 (patch) | |
tree | b297aa4f0482b8631536097a40e7e0132a0862b9 | |
parent | Merge tag 'memory-controller-drv-6.5' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl into soc/drivers (diff) | |
parent | tee: optee: Use kmemdup() to replace kmalloc + memcpy (diff) | |
download | wireguard-linux-3f711c249032fee954e92e4d04c8cd2744994291.tar.xz wireguard-linux-3f711c249032fee954e92e4d04c8cd2744994291.zip |
Merge tag 'optee-use-kmemdup-for-6.5' of https://git.linaro.org/people/jens.wiklander/linux-tee into soc/drivers
Use kmemdup() in OP-TEE driver
* tag 'optee-use-kmemdup-for-6.5' of https://git.linaro.org/people/jens.wiklander/linux-tee:
tee: optee: Use kmemdup() to replace kmalloc + memcpy
Link: https://lore.kernel.org/r/20230615130049.GA979203@rayden
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to '')
-rw-r--r-- | drivers/tee/optee/smc_abi.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c index 49702cb08f4f..54414d4def7e 100644 --- a/drivers/tee/optee/smc_abi.c +++ b/drivers/tee/optee/smc_abi.c @@ -1539,12 +1539,11 @@ static int optee_load_fw(struct platform_device *pdev, * This uses the GFP_DMA flag to ensure we are allocated memory in the * 32-bit space since TF-A cannot map memory beyond the 32-bit boundary. */ - data_buf = kmalloc(fw->size, GFP_KERNEL | GFP_DMA); + data_buf = kmemdup(fw->data, fw->size, GFP_KERNEL | GFP_DMA); if (!data_buf) { rc = -ENOMEM; goto fw_err; } - memcpy(data_buf, fw->data, fw->size); data_pa = virt_to_phys(data_buf); reg_pair_from_64(&data_pa_high, &data_pa_low, data_pa); reg_pair_from_64(&data_size_high, &data_size_low, data_size); |