Attention is currently required from: Christian Walter. Patrick Georgi has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/54095 )
Change subject: src/security/tpm: Deal with zero length tlcl writes ......................................................................
src/security/tpm: Deal with zero length tlcl writes
While memcpy(foo, bar, 0) should be a no-op, that's hard to prove for a compiler and so gcc 11.1 complains about the use of an uninitialized "bar" even though it's harmless in this case.
Change-Id: Idbffa508c2cd68790efbc0b4ab97ae1b4d85ad51 Signed-off-by: Patrick Georgi pgeorgi@google.com --- M src/security/tpm/tss/tcg-1.2/tss.c 1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/54095/1
diff --git a/src/security/tpm/tss/tcg-1.2/tss.c b/src/security/tpm/tss/tcg-1.2/tss.c index 8b7778d..413b681 100644 --- a/src/security/tpm/tss/tcg-1.2/tss.c +++ b/src/security/tpm/tss/tcg-1.2/tss.c @@ -215,7 +215,8 @@
to_tpm_uint32(cmd.buffer + tpm_nv_write_cmd.index, index); to_tpm_uint32(cmd.buffer + tpm_nv_write_cmd.length, length); - memcpy(cmd.buffer + tpm_nv_write_cmd.data, data, length); + if (length > 0) + memcpy(cmd.buffer + tpm_nv_write_cmd.data, data, length);
return tlcl_send_receive(cmd.buffer, response, sizeof(response)); }