summaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm
diff options
context:
space:
mode:
authorJi-Hun Kim <ji_hun.kim@samsung.com>2018-05-09 09:12:37 +0900
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2018-05-14 13:59:52 +0300
commitf5495bb9aca4ccd46a14161bf2d9dd72c8b7166e (patch)
treea6e2a6a4b8000b1440779575501fa7a0e4adff82 /drivers/char/tpm
parent697989164ef699a01012490fa2dd1970b17828e6 (diff)
downloadlinux-f5495bb9aca4ccd46a14161bf2d9dd72c8b7166e.tar.bz2
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.sakkine@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkine@linux.intel.com>
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r--drivers/char/tpm/eventlog/efi.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/char/tpm/eventlog/efi.c b/drivers/char/tpm/eventlog/efi.c
index 68f1e7ee60ce..3e673ab22cb4 100644
--- a/drivers/char/tpm/eventlog/efi.c
+++ b/drivers/char/tpm/eventlog/efi.c
@@ -51,10 +51,9 @@ int tpm_read_log_efi(struct tpm_chip *chip)
}
/* malloc EventLog space */
- log->bios_event_log = kmalloc(log_size, GFP_KERNEL);
+ log->bios_event_log = kmemdup(log_tbl->log, log_size, GFP_KERNEL);
if (!log->bios_event_log)
goto err_memunmap;
- memcpy(log->bios_event_log, log_tbl->log, log_size);
log->bios_event_log_end = log->bios_event_log + log_size;
tpm_log_version = log_tbl->version;