Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp579831imu; Thu, 13 Dec 2018 00:24:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/UDdLJ9ifxXWIWTGI/ts1395TiBwNb2B5M4K6p+CnAuFtyChHvFtm8vnJzmERtbkPUTRr13 X-Received: by 2002:a63:cd4c:: with SMTP id a12mr21655272pgj.252.1544689444160; Thu, 13 Dec 2018 00:24:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544689444; cv=none; d=google.com; s=arc-20160816; b=JjAgUL1Bmo9c1lqBf660yJlYwR7Rivygomxu42dNgI29pzwSvB88n0A09mMranYKji fb8afJVMa0R8bYcmeP2g1EapwQZUIneCUbY8c6AnX+adAxXdjci6gSRrsSwlTYWyZYlN FzizubsAuB492YEbOP5ceJF26jdL5WzRb/yyMkba3buK2KB6EtlXah0pYo+11vz3uRc/ 9o3dfmp4HVhyBCI+ESFghU0+gtN2sfuWwZV9fKqgpJX58BG/uZcmO+pJd5RmL9pwOz48 JuVyhXjdKopJRqOl/Vh4x9Kjdtz4MzMBugGMwiaEjmJI9ctaFeqnUQ5/XAsO3hOdIDpx 6tHA== 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=EGUMAgV8SQ+1OhezcXwCfFd3dZTUi+gU1hEN02eCvuU=; b=ThsI7dwaWhiCsojqyMRCD3qo6C8TElEnWgt0lCpbrx/enSNxxumhbaPl5lOpa4tAMG La5RPk92zKeJOFdQjzV6dfY7+7JA93aKPbrYXjBmUTUPPB1a40Z6bLIjHI0HroUnel9X GSuCKhtClhv1VFXCKdI/KFKGKbDH/NcXduHlokv6Wx3Ngd9vcQo78WqiRbDJxZRjpQmk HRfmcFiaxUJlDzxUaGoXYYiX4eyZxNMMqVgH5I7RLSRCRVA233XGJAa11blmRK0by5cL bpW2520jv8D8KJ7x2QIesdjN2stbocN+Gbc7K4L3PM5jXJdfdZypyxxej2CvTvKyMrmc 6Ptg== 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 gn20si1026932plb.98.2018.12.13.00.23.48; Thu, 13 Dec 2018 00:24:04 -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 S1727343AbeLMIOc (ORCPT + 99 others); Thu, 13 Dec 2018 03:14:32 -0500 Received: from lhrrgout.huawei.com ([185.176.76.210]:32809 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726995AbeLMIOc (ORCPT ); Thu, 13 Dec 2018 03:14:32 -0500 Received: from LHREML711-CAH.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id 467A8686D2701; Thu, 13 Dec 2018 08:14:29 +0000 (GMT) Received: from [10.204.65.144] (10.204.65.144) by smtpsuk.huawei.com (10.201.108.34) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 13 Dec 2018 08:14:24 +0000 Subject: Re: [PATCH v6 1/7] tpm: dynamically allocate the allocated_banks array To: Jarkko Sakkinen CC: , , , , , , , Nayna Jain References: <20181204082138.24600-1-roberto.sassu@huawei.com> <20181204082138.24600-2-roberto.sassu@huawei.com> <20181204231848.GA1233@linux.intel.com> <9193bc05-8222-f0d6-9ad8-a2a7eaf1a34c@huawei.com> <20181212183204.GK6333@linux.intel.com> From: Roberto Sassu Message-ID: <54e552fa-9f20-60e4-5ac9-38c567243737@huawei.com> Date: Thu, 13 Dec 2018 09:14:23 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20181212183204.GK6333@linux.intel.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.204.65.144] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/12/2018 7:32 PM, Jarkko Sakkinen wrote: > On Thu, Dec 06, 2018 at 06:56:33PM +0100, Roberto Sassu wrote: >> 2 PCR selections >> hash TPM_ALG_SHA1 >> TPMS_PCR_SELECTION length 3 >> ff ff ff >> hash TPM_ALG_SHA256 >> TPMS_PCR_SELECTION length 3 >> 00 00 00 >> >> The pcr_select fields - "ff ff ff" and "00 00 00" - are bit masks for >> the enabled PCRs. The SHA1 bank is enabled for all PCRs (0-23), while >> the SHA256 bank is not enabled. > > Uh, thanks. Can you add a note to the commit message? Ok. >>> >>> /* Check that at least some of the PCRs have been allocated. This is >>> * required because CAP_PCRS ... >>> */ >>> if (memchr_inv(pcr_selection.pcr_select, 0, pcr_selection.size_of_select)) >>> nr_allocated_banks++; >>> >>> [yeah, comment would be awesome about CAP_PCRS. Did not finish up the >>> comment because I don't know the answer] >>> >>> In addition, it would be consistent to call the local variable also >>> nr_allocated_banks (not nr_alloc_banks). >> >> Unfortunately, I exceed the limit of characters per line. > > Not sure what you mean? --- - chip->allocated_banks[nr_alloc_banks] = hash_alg; + chip->allocated_banks[nr_alloc_banks].alg_id = hash_alg; --- If I use nr_allocated_banks, the line above (see patch 5/7) exceeds the limit of 80 characters. Roberto > /Jarkko > -- HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063 Managing Director: Bo PENG, Jian LI, Yanli SHI