summaryrefslogtreecommitdiff
path: root/resources/coreboot/default/patches/0013-src-security-tpm-Deal-with-zero-length-tlcl-writes.patch
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2021-05-18 13:56:12 +0100
committerLeah Rowe <leah@libreboot.org>2021-05-18 13:56:12 +0100
commit89517ed6b9e89321e1387ed8f534d7f080ffdf57 (patch)
tree6f2085cb89b035d3cb62ad49b470a514672102d6 /resources/coreboot/default/patches/0013-src-security-tpm-Deal-with-zero-length-tlcl-writes.patch
libreboot!
this is forked from the "libre" branch in osboot, which is itself a libre, deblobbed fork of osboot, a blobbed up fork of libreboot libreboot needed to be purged clean. this is the new libreboot development repository. the old one has been abandoned
Diffstat (limited to 'resources/coreboot/default/patches/0013-src-security-tpm-Deal-with-zero-length-tlcl-writes.patch')
-rw-r--r--resources/coreboot/default/patches/0013-src-security-tpm-Deal-with-zero-length-tlcl-writes.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/resources/coreboot/default/patches/0013-src-security-tpm-Deal-with-zero-length-tlcl-writes.patch b/resources/coreboot/default/patches/0013-src-security-tpm-Deal-with-zero-length-tlcl-writes.patch
new file mode 100644
index 00000000..183c6026
--- /dev/null
+++ b/resources/coreboot/default/patches/0013-src-security-tpm-Deal-with-zero-length-tlcl-writes.patch
@@ -0,0 +1,36 @@
+From 37589dc0c9c0bb78904b0b2b9aae0ba519eb6e04 Mon Sep 17 00:00:00 2001
+From: Patrick Georgi <pgeorgi@google.com>
+Date: Wed, 12 May 2021 14:54:49 +0200
+Subject: [PATCH 13/17] 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>
+Reviewed-on: https://review.coreboot.org/c/coreboot/+/54095
+Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
+Reviewed-by: Jacob Garber <jgarber1@ualberta.ca>
+Reviewed-by: Angel Pons <th3fanbus@gmail.com>
+---
+ src/security/tpm/tss/tcg-1.2/tss.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/security/tpm/tss/tcg-1.2/tss.c b/src/security/tpm/tss/tcg-1.2/tss.c
+index 8b7778ddb2..413b68193f 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 @@ uint32_t tlcl_write(uint32_t index, const void *data, uint32_t length)
+
+ 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));
+ }
+--
+2.25.1
+