Skip to content

Commit 6979891

Browse files
jihuunJarkko Sakkinen
authored andcommitted
tpm: replace kmalloc() + memcpy() with kmemdup()
Use kmemdup rather than duplicating its implementation. Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com> Reviewed-by: James Morris <james.morris@microsoft.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
1 parent 8c81c24 commit 6979891

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

  • drivers/char/tpm/eventlog

‎drivers/char/tpm/eventlog/of.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,12 @@ int tpm_read_log_of(struct tpm_chip *chip)
6969
return -EIO;
7070
}
7171

72-
log->bios_event_log = kmalloc(size, GFP_KERNEL);
72+
log->bios_event_log = kmemdup(__va(base), size, GFP_KERNEL);
7373
if (!log->bios_event_log)
7474
return -ENOMEM;
7575

7676
log->bios_event_log_end = log->bios_event_log + size;
7777

78-
memcpy(log->bios_event_log, __va(base), size);
79-
8078
if (chip->flags & TPM_CHIP_FLAG_TPM2)
8179
return EFI_TCG2_EVENT_LOG_FORMAT_TCG_2;
8280
return EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2;

0 commit comments

Comments
 (0)