Merge tag 'soc-drivers-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
[sfrench/cifs-2.6.git] / drivers / tee / optee / smc_abi.c
index 3861ae06d902f072451bd46d99206ab8bb8e53f5..d5b28fd35d665378591674a8baaeffac5bcd77c0 100644 (file)
@@ -1541,12 +1541,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);