[PATCH 03/11] efi_loader: Use directly version_string variable

Pali Rohár pali at kernel.org
Mon Aug 2 15:18:30 CEST 2021


Macro U_BOOT_VERSION_STRING is already stored in variable version_string.
So use directly this variable instead of storing U_BOOT_VERSION_STRING into
temporary variable.

Signed-off-by: Pali Rohár <pali at kernel.org>
---
 lib/efi_loader/efi_tcg2.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
index 1319a8b37868..14353ae71c9b 100644
--- a/lib/efi_loader/efi_tcg2.c
+++ b/lib/efi_loader/efi_tcg2.c
@@ -1275,11 +1275,10 @@ free_pool:
 static efi_status_t efi_append_scrtm_version(struct udevice *dev)
 {
 	struct tpml_digest_values digest_list;
-	u8 ver[] = U_BOOT_VERSION_STRING;
 	const int pcr_index = 0;
 	efi_status_t ret;
 
-	ret = tcg2_create_digest(ver, sizeof(ver), &digest_list);
+	ret = tcg2_create_digest(version_string, strlen(version_string) + 1, &digest_list);
 	if (ret != EFI_SUCCESS)
 		goto out;
 
@@ -1288,7 +1287,7 @@ static efi_status_t efi_append_scrtm_version(struct udevice *dev)
 		goto out;
 
 	ret = tcg2_agile_log_append(pcr_index, EV_S_CRTM_VERSION, &digest_list,
-				    sizeof(ver), ver);
+				    strlen(version_string) + 1, version_string);
 
 out:
 	return ret;
-- 
2.20.1



More information about the U-Boot mailing list