diff mbox

tpm: use kmemdup() to copy the EFI event log

Message ID 20180219121026.14304-1-jarkko.sakkinen@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jarkko Sakkinen Feb. 19, 2018, 12:10 p.m. UTC
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/char/tpm/tpm_eventlog_efi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jarkko Sakkinen Feb. 20, 2018, 2:58 p.m. UTC | #1
Send an updated version with corresponding change also to
tpm_eventlog_of.c

/Jarkko

On Mon, 2018-02-19 at 14:10 +0200, Jarkko Sakkinen wrote:
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> ---
>  drivers/char/tpm/tpm_eventlog_efi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_eventlog_efi.c
> b/drivers/char/tpm/tpm_eventlog_efi.c
> index e3f9ffd341d2..57c8b3cc46be 100644
> --- a/drivers/char/tpm/tpm_eventlog_efi.c
> +++ b/drivers/char/tpm/tpm_eventlog_efi.c
> @@ -50,10 +50,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;
diff mbox

Patch

diff --git a/drivers/char/tpm/tpm_eventlog_efi.c b/drivers/char/tpm/tpm_eventlog_efi.c
index e3f9ffd341d2..57c8b3cc46be 100644
--- a/drivers/char/tpm/tpm_eventlog_efi.c
+++ b/drivers/char/tpm/tpm_eventlog_efi.c
@@ -50,10 +50,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;