diff mbox series

[U-Boot,1/1] tpm: simplify: tpm_set_global_lock()

Message ID 20190205003841.10796-1-xypron.glpk@gmx.de
State Accepted
Commit c7cd4afb923bd54f18bee71993127aca550f2737
Delegated to: Tom Rini
Headers show
Series [U-Boot,1/1] tpm: simplify: tpm_set_global_lock() | expand

Commit Message

Heinrich Schuchardt Feb. 5, 2019, 12:38 a.m. UTC
When in pack_byte_string() memcpy() is called for size 0 the source buffer
address has no relevance. So we can use NULL here.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 lib/tpm-v1.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Simon Glass Feb. 8, 2019, 4:11 a.m. UTC | #1
On Mon, 4 Feb 2019 at 17:38, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> When in pack_byte_string() memcpy() is called for size 0 the source buffer
> address has no relevance. So we can use NULL here.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  lib/tpm-v1.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini Feb. 20, 2019, 1:56 a.m. UTC | #2
On Tue, Feb 05, 2019 at 01:38:41AM +0100, Heinrich Schuchardt wrote:

> When in pack_byte_string() memcpy() is called for size 0 the source buffer
> address has no relevance. So we can use NULL here.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c
index 3e89f84544..b4498e6afc 100644
--- a/lib/tpm-v1.c
+++ b/lib/tpm-v1.c
@@ -211,9 +211,7 @@  u32 tpm_nv_write_value(struct udevice *dev, u32 index, const void *data,
 
 uint32_t tpm_set_global_lock(struct udevice *dev)
 {
-	u32 x;
-
-	return tpm_nv_write_value(dev, TPM_NV_INDEX_0, (uint8_t *)&x, 0);
+	return tpm_nv_write_value(dev, TPM_NV_INDEX_0, NULL, 0);
 }
 
 u32 tpm_extend(struct udevice *dev, u32 index, const void *in_digest,