Commit 69798916 authored by Ji-Hun Kim's avatar Ji-Hun Kim Committed by Jarkko Sakkinen

tpm: replace kmalloc() + memcpy() with kmemdup()

Use kmemdup rather than duplicating its implementation.
Signed-off-by: default avatarJi-Hun Kim <ji_hun.kim@samsung.com>
Reviewed-by: default avatarJames Morris <james.morris@microsoft.com>
Reviewed-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
parent 8c81c247
...@@ -69,14 +69,12 @@ int tpm_read_log_of(struct tpm_chip *chip) ...@@ -69,14 +69,12 @@ int tpm_read_log_of(struct tpm_chip *chip)
return -EIO; return -EIO;
} }
log->bios_event_log = kmalloc(size, GFP_KERNEL); log->bios_event_log = kmemdup(__va(base), size, GFP_KERNEL);
if (!log->bios_event_log) if (!log->bios_event_log)
return -ENOMEM; return -ENOMEM;
log->bios_event_log_end = log->bios_event_log + size; log->bios_event_log_end = log->bios_event_log + size;
memcpy(log->bios_event_log, __va(base), size);
if (chip->flags & TPM_CHIP_FLAG_TPM2) if (chip->flags & TPM_CHIP_FLAG_TPM2)
return EFI_TCG2_EVENT_LOG_FORMAT_TCG_2; return EFI_TCG2_EVENT_LOG_FORMAT_TCG_2;
return EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2; return EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment