summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorJi-Hun Kim <ji_hun.kim@samsung.com>2018-05-09 03:12:36 +0300
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2018-05-14 13:59:43 +0300
commit697989164ef699a01012490fa2dd1970b17828e6 (patch)
tree6968eb8284bb51bef2142b31a0274161f9857173 /drivers/char
parent8c81c24758ffbf17cf06c6835d361ffa57be2f0e (diff)
downloadlinux-697989164ef699a01012490fa2dd1970b17828e6.tar.xz
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>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/eventlog/of.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/char/tpm/eventlog/of.c b/drivers/char/tpm/eventlog/of.c
index b7cac4794ed2..bba5fba6cb3b 100644
--- a/drivers/char/tpm/eventlog/of.c
+++ b/drivers/char/tpm/eventlog/of.c
@@ -69,14 +69,12 @@ int tpm_read_log_of(struct tpm_chip *chip)
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)
return -ENOMEM;
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)
return EFI_TCG2_EVENT_LOG_FORMAT_TCG_2;
return EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2;