All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] tpm: replace kmalloc() + memcpy() with kmemdup()
       [not found] <CGME20180509001258epcas1p4e8db163d8babd90284dd6afb6a96eb0f@epcas1p4.samsung.com>
@ 2018-05-09  0:12   ` Ji-Hun Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Ji-Hun Kim @ 2018-05-09  0:12 UTC (permalink / raw)
  To: peterhuewe, tweek
  Cc: jarkko.sakkinen, jgg, arnd, gregkh, javierm, sonnyrao,
	ji_hun.kim, enric.balletbo, linux-integrity, linux-kernel,
	kernel-janitors

Use kmemdup rather than duplicating its implementation.

Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 1/2] tpm: replace kmalloc() + memcpy() with kmemdup()
@ 2018-05-09  0:12   ` Ji-Hun Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Ji-Hun Kim @ 2018-05-09  0:12 UTC (permalink / raw)
  To: peterhuewe, tweek
  Cc: jarkko.sakkinen, jgg, arnd, gregkh, javierm, sonnyrao,
	ji_hun.kim, enric.balletbo, linux-integrity, linux-kernel,
	kernel-janitors

Use kmemdup rather than duplicating its implementation.

Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/2] tpm: replace kmalloc() + memcpy() with kmemdup()
       [not found]   ` <CGME20180509001300epcas2p3971900d48408aef6a80f59b9480aac16@epcas2p3.samsung.com>
@ 2018-05-09  0:12       ` Ji-Hun Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Ji-Hun Kim @ 2018-05-09  0:12 UTC (permalink / raw)
  To: peterhuewe, tweek
  Cc: jarkko.sakkinen, jgg, arnd, gregkh, javierm, sonnyrao,
	ji_hun.kim, enric.balletbo, linux-integrity, linux-kernel,
	kernel-janitors

Use kmemdup rather than duplicating its implementation.

Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com>
---
 drivers/char/tpm/eventlog/efi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/char/tpm/eventlog/efi.c b/drivers/char/tpm/eventlog/efi.c
index 68f1e7e..3e673ab 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;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/2] tpm: replace kmalloc() + memcpy() with kmemdup()
@ 2018-05-09  0:12       ` Ji-Hun Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Ji-Hun Kim @ 2018-05-09  0:12 UTC (permalink / raw)
  To: peterhuewe, tweek
  Cc: jarkko.sakkinen, jgg, arnd, gregkh, javierm, sonnyrao,
	ji_hun.kim, enric.balletbo, linux-integrity, linux-kernel,
	kernel-janitors

Use kmemdup rather than duplicating its implementation.

Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com>
---
 drivers/char/tpm/eventlog/efi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/char/tpm/eventlog/efi.c b/drivers/char/tpm/eventlog/efi.c
index 68f1e7e..3e673ab 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;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] tpm: replace kmalloc() + memcpy() with kmemdup()
  2018-05-09  0:12   ` Ji-Hun Kim
@ 2018-05-09 19:16     ` James Morris
  -1 siblings, 0 replies; 12+ messages in thread
From: James Morris @ 2018-05-09 19:16 UTC (permalink / raw)
  To: Ji-Hun Kim
  Cc: peterhuewe, tweek, jarkko.sakkinen, jgg, arnd, gregkh, javierm,
	sonnyrao, enric.balletbo, linux-integrity, linux-kernel,
	kernel-janitors

On Wed, 9 May 2018, Ji-Hun Kim wrote:

> 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>


-- 
James Morris
<jmorris@namei.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] tpm: replace kmalloc() + memcpy() with kmemdup()
@ 2018-05-09 19:16     ` James Morris
  0 siblings, 0 replies; 12+ messages in thread
From: James Morris @ 2018-05-09 19:16 UTC (permalink / raw)
  To: Ji-Hun Kim
  Cc: peterhuewe, tweek, jarkko.sakkinen, jgg, arnd, gregkh, javierm,
	sonnyrao, enric.balletbo, linux-integrity, linux-kernel,
	kernel-janitors

On Wed, 9 May 2018, Ji-Hun Kim wrote:

> 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>


-- 
James Morris
<jmorris@namei.org>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] tpm: replace kmalloc() + memcpy() with kmemdup()
  2018-05-09  0:12       ` Ji-Hun Kim
@ 2018-05-09 19:16         ` James Morris
  -1 siblings, 0 replies; 12+ messages in thread
From: James Morris @ 2018-05-09 19:16 UTC (permalink / raw)
  To: Ji-Hun Kim
  Cc: peterhuewe, tweek, jarkko.sakkinen, jgg, arnd, gregkh, javierm,
	sonnyrao, enric.balletbo, linux-integrity, linux-kernel,
	kernel-janitors

On Wed, 9 May 2018, Ji-Hun Kim wrote:

> 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>


-- 
James Morris
<jmorris@namei.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] tpm: replace kmalloc() + memcpy() with kmemdup()
@ 2018-05-09 19:16         ` James Morris
  0 siblings, 0 replies; 12+ messages in thread
From: James Morris @ 2018-05-09 19:16 UTC (permalink / raw)
  To: Ji-Hun Kim
  Cc: peterhuewe, tweek, jarkko.sakkinen, jgg, arnd, gregkh, javierm,
	sonnyrao, enric.balletbo, linux-integrity, linux-kernel,
	kernel-janitors

On Wed, 9 May 2018, Ji-Hun Kim wrote:

> 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>


-- 
James Morris
<jmorris@namei.org>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] tpm: replace kmalloc() + memcpy() with kmemdup()
  2018-05-09  0:12   ` Ji-Hun Kim
@ 2018-05-14 10:58     ` Jarkko Sakkinen
  -1 siblings, 0 replies; 12+ messages in thread
From: Jarkko Sakkinen @ 2018-05-14 10:58 UTC (permalink / raw)
  To: Ji-Hun Kim
  Cc: peterhuewe, tweek, jgg, arnd, gregkh, javierm, sonnyrao,
	enric.balletbo, linux-integrity, linux-kernel, kernel-janitors

On Wed, May 09, 2018 at 09:12:36AM +0900, Ji-Hun Kim wrote:
> Use kmemdup rather than duplicating its implementation.
> 
> Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

/Jarkko

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] tpm: replace kmalloc() + memcpy() with kmemdup()
@ 2018-05-14 10:58     ` Jarkko Sakkinen
  0 siblings, 0 replies; 12+ messages in thread
From: Jarkko Sakkinen @ 2018-05-14 10:58 UTC (permalink / raw)
  To: Ji-Hun Kim
  Cc: peterhuewe, tweek, jgg, arnd, gregkh, javierm, sonnyrao,
	enric.balletbo, linux-integrity, linux-kernel, kernel-janitors

On Wed, May 09, 2018 at 09:12:36AM +0900, Ji-Hun Kim wrote:
> Use kmemdup rather than duplicating its implementation.
> 
> Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

/Jarkko

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] tpm: replace kmalloc() + memcpy() with kmemdup()
  2018-05-09  0:12       ` Ji-Hun Kim
@ 2018-05-14 10:58         ` Jarkko Sakkinen
  -1 siblings, 0 replies; 12+ messages in thread
From: Jarkko Sakkinen @ 2018-05-14 10:58 UTC (permalink / raw)
  To: Ji-Hun Kim
  Cc: peterhuewe, tweek, jgg, arnd, gregkh, javierm, sonnyrao,
	enric.balletbo, linux-integrity, linux-kernel, kernel-janitors

On Wed, May 09, 2018 at 09:12:37AM +0900, Ji-Hun Kim wrote:
> Use kmemdup rather than duplicating its implementation.
> 
> Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkine@linux.intel.com>

/Jarkko

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] tpm: replace kmalloc() + memcpy() with kmemdup()
@ 2018-05-14 10:58         ` Jarkko Sakkinen
  0 siblings, 0 replies; 12+ messages in thread
From: Jarkko Sakkinen @ 2018-05-14 10:58 UTC (permalink / raw)
  To: Ji-Hun Kim
  Cc: peterhuewe, tweek, jgg, arnd, gregkh, javierm, sonnyrao,
	enric.balletbo, linux-integrity, linux-kernel, kernel-janitors

On Wed, May 09, 2018 at 09:12:37AM +0900, Ji-Hun Kim wrote:
> Use kmemdup rather than duplicating its implementation.
> 
> Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkine@linux.intel.com>

/Jarkko

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-05-14 10:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180509001258epcas1p4e8db163d8babd90284dd6afb6a96eb0f@epcas1p4.samsung.com>
2018-05-09  0:12 ` [PATCH 1/2] tpm: replace kmalloc() + memcpy() with kmemdup() Ji-Hun Kim
2018-05-09  0:12   ` Ji-Hun Kim
     [not found]   ` <CGME20180509001300epcas2p3971900d48408aef6a80f59b9480aac16@epcas2p3.samsung.com>
2018-05-09  0:12     ` [PATCH 2/2] " Ji-Hun Kim
2018-05-09  0:12       ` Ji-Hun Kim
2018-05-09 19:16       ` James Morris
2018-05-09 19:16         ` James Morris
2018-05-14 10:58       ` Jarkko Sakkinen
2018-05-14 10:58         ` Jarkko Sakkinen
2018-05-09 19:16   ` [PATCH 1/2] " James Morris
2018-05-09 19:16     ` James Morris
2018-05-14 10:58   ` Jarkko Sakkinen
2018-05-14 10:58     ` Jarkko Sakkinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.