From patchwork Tue Nov 16 23:24:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 519209 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp113230imj; Tue, 16 Nov 2021 15:24:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJyGMzw+ciGYDTJfIRWLDfcmIfyNGB3/T+wSZy7qwjffs/M1mSYO5vXAcmsvxkCONmXChgMr X-Received: by 2002:aa7:ce1a:: with SMTP id d26mr15853615edv.189.1637105084486; Tue, 16 Nov 2021 15:24:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637105084; cv=none; d=google.com; s=arc-20160816; b=BcZ0Yh5nWee1qOF2xiYsMDyQrR0Q0TLpTwRkbkwWyadoBpoMTbUEpeuVu9m2ttX0HK WKaFFkck1uuOZJC44EE6ty7wEBMbwjlVscj/F3MkS+H82hDzYn1EtD2rI8XdlEDiqLSD WvlK8MmzET6vX9OUsKdXNfWr4sLMex2BBsUIhYzetj+JC8I4xtiA/qS5t4iZWA8hrgI1 /19LK/lHVFDyyln+HMDxFtjY2qINy+z0I9Hh5/28WyWyVNMSjdLNSxZZ/5VklpmRd9fO EUiBbKJtONv9nO/+6lITjUddWvrgiDezrnnbuuH9S5wYk7nf++Vhva43iZ2IFwO7+vpe Q3Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=+K9AZzJ9eWNsCmzpBGBO+bjGxSoLlCyZ6k6PY9hrpFc=; b=BATgA2DBGzt6f2K1kDDkvyytzJYxb9o+y5KK7AbY1AM0/NKTNX0YPyxwA1gYmI/eGU kRL0JF+BkDQwkYiGqJB7rLqbw2hBVsUIihuPhtLUCE6kJmcaMReU/agxHb3RwiQBvkKW ryaXFe+j+lmto/HjC113Cv9FuUfdhzQV0GpyDwjcpV8hHZIpaAYVlFzHGAono6WXOXLi kfWcFtSpJvfCF+lVmkeF/LD48uWXFJxszdPjlX8kaYbf5i9qqD8O7ipsx3VcyQEykq3F bKqC7pqOf30eP7GWPBqatafYfSr/zZEk5TxDLFCJfMQhzZx4KfYT2xeeVogj1QM7TiWd wDkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ey9go4ex; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id aq13si31368829ejc.491.2021.11.16.15.24.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Nov 2021 15:24:44 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ey9go4ex; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3D97282F5E; Wed, 17 Nov 2021 00:24:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ey9go4ex"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1CE2B82F9A; Wed, 17 Nov 2021 00:24:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E518082EEA for ; Wed, 17 Nov 2021 00:24:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wm1-x32e.google.com with SMTP id p3-20020a05600c1d8300b003334fab53afso3287853wms.3 for ; Tue, 16 Nov 2021 15:24:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+K9AZzJ9eWNsCmzpBGBO+bjGxSoLlCyZ6k6PY9hrpFc=; b=ey9go4exgVAAmZr1hunBCm542wfcW7ksXNn6kjiMd//Cn3wLQPmI/g7B4McAJ5wE3N etA6NHOUcTnxbgAloq5ieFnA+wkd7qDFjJad0jlvagaKScfFu/KJOajlhWh/rkgfEsGP 2xa0g5YsO8s0QFBYaIKKYO5cgTiqp0P+A5f8yuQRYOojS+6/qV/+zXUtiWideUZzUdC1 bwPn/mSUhOAKlB/Z2bp59hm859on8nyTH00JYqx1UpqxyTvTUO5P/iadt6Mi/NaQVw4M 6AA9JTLNzdxX4xXNAzEvPZytwPjm6WctTVC/0q6fzX9lg+tMStEPaKt9STJrEmXq+ca0 sLIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+K9AZzJ9eWNsCmzpBGBO+bjGxSoLlCyZ6k6PY9hrpFc=; b=WPUaech0pxFpUF3KpBbkW6ACTt9OiIOflWTBllkbGzcT6dLxb93az762vilEu93Z5x dVppIYyOmJzKwAYd9ts8nGm3C+MLrBg1lZOEQ47qy2F+SugxdNHzE5R2YuNdieTOHl9K hRRhTGH7qpGoZvPMrcYnUBZkQEVzybYbOicXziLtMv+otZ8ya+56ybN6ii2lUw2BJMjK 0iGMutLwaVbwTW/fz2SXFqUO0k/AUIK+Fx35niOXg0t8Jk9Zw6GDKiZDpNiPfzO2jixq WsHVKsYdqIrAD2Q94OBCKvEZFmAxR27u6CtOuThTtpy62r2D0Fv1dwHpIYM6fQp7Z9ep 4avg== X-Gm-Message-State: AOAM530zDLK2U34qbraAWyrPP5vwPCeDflogeiBbTsJEjy5ACnXl7GNI XGFdniQr8I7ZP/hdMWeS69DXtA== X-Received: by 2002:a05:600c:1d9b:: with SMTP id p27mr74367017wms.123.1637105050528; Tue, 16 Nov 2021 15:24:10 -0800 (PST) Received: from apalos.home ([2a02:587:4627:18c0:2e56:dcff:fe9a:8f06]) by smtp.gmail.com with ESMTPSA id be3sm4095615wmb.1.2021.11.16.15.24.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Nov 2021 15:24:10 -0800 (PST) From: Ilias Apalodimas To: xypron.glpk@gmx.de Cc: Ilias Apalodimas , Alexander Graf , u-boot@lists.denx.de Subject: [PATCH] efi_loader: fix FinalEvent table initial position Date: Wed, 17 Nov 2021 01:24:07 +0200 Message-Id: <20211116232407.291489-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.35 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean When initializing the final event table in create_final_event() we are setting the initial buffer position to sizeof(*final_event). Although we clear the buffer correctly and won't cause any problems, we should start logging events starting from zero. While at it add a cast when defining the final_event. Signed-off-by: Ilias Apalodimas --- lib/efi_loader/efi_tcg2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index 189e4a5ba59c..634556342a7c 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -1257,10 +1257,11 @@ static efi_status_t create_final_event(void) goto out; memset(event_log.final_buffer, 0xff, TPM2_EVENT_LOG_SIZE); - final_event = event_log.final_buffer; + final_event = + (struct efi_tcg2_final_events_table *)event_log.final_buffer; final_event->number_of_events = 0; final_event->version = EFI_TCG2_FINAL_EVENTS_TABLE_VERSION; - event_log.final_pos = sizeof(*final_event); + event_log.final_pos = 0; ret = efi_install_configuration_table(&efi_guid_final_events, final_event); if (ret != EFI_SUCCESS) {