From: Zbigniew Jędrzejewski-Szmek Date: Tue, 17 Oct 2023 08:55:57 +0000 (+0200) Subject: efi: do not memzero fields before initializing them X-Git-Tag: v255-rc1~203^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=586f19976af82e7bbb4f776ad841b190f700d3ec;p=thirdparty%2Fsystemd.git efi: do not memzero fields before initializing them In all three cases we immediately overwrite the whole field anyway, so the call to memzero is not needed. --- diff --git a/src/boot/efi/measure.c b/src/boot/efi/measure.c index 28ec6b7d825..01c97c883c0 100644 --- a/src/boot/efi/measure.c +++ b/src/boot/efi/measure.c @@ -25,7 +25,7 @@ static EFI_STATUS tpm1_measure_to_pcr_and_event_log( assert(description); desc_len = strsize16(description); - tcg_event = xmalloc0(offsetof(TCG_PCR_EVENT, Event) + desc_len); + tcg_event = xmalloc(offsetof(TCG_PCR_EVENT, Event) + desc_len); *tcg_event = (TCG_PCR_EVENT) { .EventSize = desc_len, .PCRIndex = pcrindex, @@ -62,8 +62,7 @@ static EFI_STATUS tpm2_measure_to_pcr_and_tagged_event_log( desc_len = strsize16(description); event_size = offsetof(EFI_TCG2_EVENT, Event) + offsetof(EFI_TCG2_TAGGED_EVENT, Event) + desc_len; - event = xmalloc0(event_size); - + event = xmalloc(event_size); *event = (struct event) { .tcg_event = (EFI_TCG2_EVENT) { .Size = event_size, @@ -106,7 +105,7 @@ static EFI_STATUS tpm2_measure_to_pcr_and_event_log( * here. */ desc_len = strsize16(description); - tcg_event = xmalloc0(offsetof(EFI_TCG2_EVENT, Event) + desc_len); + tcg_event = xmalloc(offsetof(EFI_TCG2_EVENT, Event) + desc_len); *tcg_event = (EFI_TCG2_EVENT) { .Size = offsetof(EFI_TCG2_EVENT, Event) + desc_len, .Header.HeaderSize = sizeof(EFI_TCG2_EVENT_HEADER),