[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <1525824757-21835-1-git-send-email-ji_hun.kim@samsung.com>
Date: Wed, 09 May 2018 09:12:36 +0900
From: Ji-Hun Kim <ji_hun.kim@...sung.com>
To: peterhuewe@....de, tweek@...gle.com
Cc: jarkko.sakkinen@...ux.intel.com, jgg@...pe.ca, arnd@...db.de,
gregkh@...uxfoundation.org, javierm@...hat.com,
sonnyrao@...omium.org, ji_hun.kim@...sung.com,
enric.balletbo@...labora.com, linux-integrity@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH 1/2] tpm: replace kmalloc() + memcpy() with kmemdup()
Use kmemdup rather than duplicating its implementation.
Signed-off-by: Ji-Hun Kim <ji_hun.kim@...sung.com>
---
drivers/char/tpm/eventlog/of.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/char/tpm/eventlog/of.c b/drivers/char/tpm/eventlog/of.c
index b7cac47..bba5fba 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;
--
1.9.1
Powered by blists - more mailing lists