From 75aaabcd9ade5d2a2ad068d2543e8e82011b979f Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Mon, 26 Sep 2016 08:43:26 +0200 Subject: [PATCH] tpm: fix TPM reset use the right prototype for the memset() clearing the TPM .bss space on reset, use addresses of variables instead of their values, and do not clear tpm_resisters.c .bss section, tpm_init() does the right thing. BRANCH=gru BUG=chrome-os-partner:52366 TEST=make buildall Change-Id: I4c8c0ae61a0e70c9fc211420bbf44bbc7d8de3ed Signed-off-by: Vincent Palatin Signed-off-by: Vadim Bendebury Reviewed-on: https://chromium-review.googlesource.com/389331 Commit-Ready: Bill Richardson Reviewed-by: Bill Richardson --- common/tpm_registers.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/tpm_registers.c b/common/tpm_registers.c index 5728dc6f92..dce342ee5f 100644 --- a/common/tpm_registers.c +++ b/common/tpm_registers.c @@ -614,7 +614,9 @@ static void tpm_reset_now(void) * includes this file's .bss in the same section, so it will be cleared * at the same time. */ - memset(__bss_libtpm2_start, __bss_libtpm2_end - __bss_libtpm2_start, 0); + memset(&__bss_libtpm2_start, 0, + (uintptr_t)(&__bss_libtpm2_end) - + (uintptr_t)(&__bss_libtpm2_start)); /* * NOTE: Any initialized variables in this file must be placed in a