Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1968445imu; Tue, 6 Nov 2018 07:08:25 -0800 (PST) X-Google-Smtp-Source: AJdET5fY2RXJ1VCIZGkscId/76sVDfgmQ1gyhlxI4+A3s00o2hZZZDIZDghr8pnA7bBoG6/apiot X-Received: by 2002:a62:4b8c:: with SMTP id d12-v6mr24659466pfj.38.1541516905094; Tue, 06 Nov 2018 07:08:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541516905; cv=none; d=google.com; s=arc-20160816; b=lU/TnEaadiwlTIEKnITpa769MthqWYDWlh6w8zkCS80I9/s4/U7ovSFX4B34p1urCu GwDkdMoWDG1YtHm1mryBCTgSt44iPR0rs6k7wIrmlAPY4YuuD3O+7WvSr88vRRMFhaKo 0VD3iO2iRVjVgLgfE0gvqLjEsDRp7olzWTiO/HWyYGF0354cC+DSuedE2FqchLPROH9A 2VbWhYi96gO1ciSYUPUBKfQV7vANg4dGkJtoAH1xi8Kx/Dkp3w44bUwxDN9RcjGjHCPU Rxmms0Z0zOVSd/zdISs//miUZyzzcZ5YYeOEmocr6flVNDUwYzAffE8a2DRX/kSrtdOA RcOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=AIBv4w747PaQSScEgF2/sbWR6JOm4EbGQkM96FO0zBw=; b=hvukGfE/vlh6uKWY0kYVEUMAEPOx82I2Hw7ijV8FyOVWxBaeV8t4Qx0avnTUxefz3S wsoc3eJlwI9NlU7nFZq9e2vCtw/0iGacGh/m02IwP7QHMLmOtOTy6dSVUI7vnd15cy9u zHIDFVzUsknuqsw61Cd0jov9IBEdVzRkg7ilItJlXBeh2XqgUHc6h0/rg8lcw45cgL1b OOSozCoH1Tu7mm1whcjwIHD5c4Kgxv5yrk/dOf4LxYkqBfZVk8unERT7JHsuCAaTn5qx 4mf1H+uBISd2n/6Uy07tvf7dBGZW4J3K99jRHiMyNKVE04JBz47Ra48TB4JslHi+u7A9 zpng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v66-v6si42731446pgv.289.2018.11.06.07.07.52; Tue, 06 Nov 2018 07:08:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388263AbeKGAbo (ORCPT + 99 others); Tue, 6 Nov 2018 19:31:44 -0500 Received: from lhrrgout.huawei.com ([185.176.76.210]:32716 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387593AbeKGAbo (ORCPT ); Tue, 6 Nov 2018 19:31:44 -0500 Received: from LHREML712-CAH.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id CF8D9A329698C; Tue, 6 Nov 2018 15:06:02 +0000 (GMT) Received: from roberto-HP-EliteDesk-800-G2-DM-65W.huawei.com (10.204.65.153) by smtpsuk.huawei.com (10.201.108.35) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 6 Nov 2018 15:05:54 +0000 From: Roberto Sassu To: , CC: , , , , Roberto Sassu Subject: [PATCH v4 2/6] tpm: remove definition of TPM2_ACTIVE_PCR_BANKS Date: Tue, 6 Nov 2018 16:01:55 +0100 Message-ID: <20181106150159.1136-3-roberto.sassu@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181106150159.1136-1-roberto.sassu@huawei.com> References: <20181106150159.1136-1-roberto.sassu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.204.65.153] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org tcg_efi_specid_event and tcg_pcr_event2 declaration contains static arrays for a list of hash algorithms used for event logs and event log digests. However, according to TCG EFI Protocol Specification, these arrays have variable sizes and are not suitable for parsing events with type casting. Since declaring static arrays with hard-coded sizes does not help to parse data after these arrays, this patch removes the declaration of TPM2_ACTIVE_PCR_BANKS and sets the size of the arrays above to zero. Fixes: 4d23cc323cdb ("tpm: add securityfs support for TPM 2.0 firmware event log") Signed-off-by: Roberto Sassu --- include/linux/tpm_eventlog.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h index 20d9da77fc11..3d5d162f09cc 100644 --- a/include/linux/tpm_eventlog.h +++ b/include/linux/tpm_eventlog.h @@ -8,7 +8,6 @@ #define TCG_EVENT_NAME_LEN_MAX 255 #define MAX_TEXT_EVENT 1000 /* Max event string length */ #define ACPI_TCPA_SIG "TCPA" /* 0x41504354 /'TCPA' */ -#define TPM2_ACTIVE_PCR_BANKS 3 #define EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 0x1 #define EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 0x2 @@ -90,7 +89,7 @@ struct tcg_efi_specid_event { u8 spec_errata; u8 uintnsize; u32 num_algs; - struct tcg_efi_specid_event_algs digest_sizes[TPM2_ACTIVE_PCR_BANKS]; + struct tcg_efi_specid_event_algs digest_sizes[0]; u8 vendor_info_size; u8 vendor_info[0]; } __packed; @@ -117,7 +116,7 @@ struct tcg_pcr_event2 { u32 pcr_idx; u32 event_type; u32 count; - struct tpm2_digest digests[TPM2_ACTIVE_PCR_BANKS]; + struct tpm2_digest digests[0]; struct tcg_event_field event; } __packed; -- 2.17.1