Skip to content

Commit 3f711c2

Browse files
committed
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>
2 parents 57cf663 + 6a8b7e8 commit 3f711c2

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/tee/optee/smc_abi.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,12 +1539,11 @@ static int optee_load_fw(struct platform_device *pdev,
15391539
* This uses the GFP_DMA flag to ensure we are allocated memory in the
15401540
* 32-bit space since TF-A cannot map memory beyond the 32-bit boundary.
15411541
*/
1542-
data_buf = kmalloc(fw->size, GFP_KERNEL | GFP_DMA);
1542+
data_buf = kmemdup(fw->data, fw->size, GFP_KERNEL | GFP_DMA);
15431543
if (!data_buf) {
15441544
rc = -ENOMEM;
15451545
goto fw_err;
15461546
}
1547-
memcpy(data_buf, fw->data, fw->size);
15481547
data_pa = virt_to_phys(data_buf);
15491548
reg_pair_from_64(&data_pa_high, &data_pa_low, data_pa);
15501549
reg_pair_from_64(&data_size_high, &data_size_low, data_size);

0 commit comments

Comments
 (0)