Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp542849imu; Mon, 5 Nov 2018 05:10:57 -0800 (PST) X-Google-Smtp-Source: AJdET5emJZoasMK4T4ubpzeHY69unTHx1M2bZjbTwTnrNFJo0mm3FaugyKA4bmSHG9rScte40Vqc X-Received: by 2002:a62:9f11:: with SMTP id g17-v6mr21779493pfe.144.1541423457287; Mon, 05 Nov 2018 05:10:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541423457; cv=none; d=google.com; s=arc-20160816; b=KjD74fdkVBAW6ocYL9Dj7ArGSUKxvllmTb4jky0iPtr9q//F3sb+/AZbPRPlylGR8+ z6uByvD5hwYwIBMWIxJmOSZeqBKROWKwR+FDbjTSiZoYp6mLkbU4Q63f2EnzZAw9Krls SCZZTlqTsgTnIuCvYH9BJcIg2sjTj6oJ+OCuIhYuq2/j6FytRWosPGJ62kQuvyVj3Doq VljiQIRxOgp5Gvadc1LsgLxMjgwS98meoU/f7KUqhBSOYzNmWKDUN5cJcFerhRpBfmaG 3ZhfHSE+qChpPexqYOrI76rpfo1wKHT+LB806C3FEHc4TwehobZLvHJJfV0wFqOMyXv9 Xlnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=yu1v+856RrX4BQTdWf0io7WgwpXsuWmT+CrH+CU/Fxc=; b=pYyQi64aiOFFRf+wNGsOwlmb2xWewX7lr2RlJ2HZVgsm1vuY0mtBG3nd6Pvjoxd5ks j9c1nkuJhp32eXvyBukEpVXoOmxVYBR77vA1gB0RRQDUNTg6bEarMVp/HBy0lKP06BPO 09vuIyxhfWR9mrDq06z7DP4/HFguLavrJ8mKy98HBhstImvuRMPVk0qR1j96T8QD3lR1 HYij9amGu1PIZ7fHzw0pej4/u1EgoXlxTGOrcqPLOG1Lf1GYGjW8Kmr407slGP3+fYhQ ImUeSOjKrC8MSLI7YjQExYo36RKaJBF+Bn4cnT3VrHNBXGCpCR4OH6HrWccRkGfuaFy4 7UpQ== 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 j20si3448187pgg.162.2018.11.05.05.10.35; Mon, 05 Nov 2018 05:10:57 -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 S1729980AbeKEW3C (ORCPT + 99 others); Mon, 5 Nov 2018 17:29:02 -0500 Received: from lhrrgout.huawei.com ([185.176.76.210]:32713 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729198AbeKEW3C (ORCPT ); Mon, 5 Nov 2018 17:29:02 -0500 Received: from LHREML713-CAH.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 0D6A9FFDEDDA; Mon, 5 Nov 2018 13:09:18 +0000 (GMT) Received: from [10.204.65.142] (10.204.65.142) by smtpsuk.huawei.com (10.201.108.36) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 5 Nov 2018 13:09:12 +0000 Subject: Re: [PATCH v3 4/5] tpm: retrieve digest size of unknown algorithms with PCR read To: Jarkko Sakkinen CC: Mimi Zohar , , , , References: <20181030154711.2782-1-roberto.sassu@huawei.com> <20181030154711.2782-5-roberto.sassu@huawei.com> <1541088173.4035.26.camel@linux.ibm.com> <3034c896-788b-50f9-23cb-f4b2cd6363e6@huawei.com> <20181105120147.GA7621@linux.intel.com> From: Roberto Sassu Message-ID: <3b198ce9-9e2e-5290-bd40-e9a62da1f50d@huawei.com> Date: Mon, 5 Nov 2018 14:09:12 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181105120147.GA7621@linux.intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.204.65.142] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/5/2018 1:01 PM, Jarkko Sakkinen wrote: > On Mon, Nov 05, 2018 at 10:47:19AM +0100, Roberto Sassu wrote: >>> Commit 1db15344f874 ("tpm: implement TPM 2.0 capability to get active >>> PCR banks") defined active_banks[7].  Subsequently, commit >>> 4d23cc323cdb ("tpm: add securityfs support for TPM 2.0 firmware event >>> log") defined TPM2_PCR_ACTIVE_BANKS as 3.  I'm not sure which is the >>> correct value, but the number of active_banks should not be hard coded >>> here. >> >> Jarkko, should I change the value of TPM2_PCR_ACTIVE_BANKS, or set the >> size of the active_banks array to TPM2_PCR_ACTIVE_BANKS? > > Hi, sorry I missed your patch set. Please add me either to 'To' or 'Cc' > field of the email if you want a quick response. > > I think the implementation is flakky in both places and should be fixed > before doing any other changes. Thanks James for pointing out these > commits. > > What you need to do is to create a prequel commit that reads the number > of banks to a variable e.g. > > unsigned int nr_active_banks; > > and allocate 'active_banks' dynamically and change the places that > James pointed out. I guess it is OK to have a commit with two 'Fixes' > tags. Ok, then I can remove patch 1/5 if nr_active_banks is included in the tpm_chip structure. Roberto > /Jarkko > -- HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063 Managing Director: Bo PENG, Jian LI, Yanli SHI