Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3806175rdh; Tue, 28 Nov 2023 04:35:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsCcMOS9OFGgEJaCA0tbC8RsAdc94APOjBRIE4/BbKCu5i8Y/xn8SlOZjpx5rM6XKvbBl7 X-Received: by 2002:a17:90b:388d:b0:285:da91:69d9 with SMTP id mu13-20020a17090b388d00b00285da9169d9mr5991777pjb.9.1701174940764; Tue, 28 Nov 2023 04:35:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701174940; cv=none; d=google.com; s=arc-20160816; b=emUCzGIA4sbx+XUZgaFD4khd1XmA7CfxFOTwp0kiFcy5HeExG7D1CV9aM40TnoS0pC 7W7rp3KfZFqJJoppxaeBcu9cNH1BmThls5xU4dC+xCLKbrhovjbo2nn3rhm6dtvE11bS 8223tpE67Q1OccI18sHjeYZJ4CUQ8OP+oR967sSzxsyHcD4NI5ta8PAL1XE7XLLMuIGu dbOa4yjHSbZsRYp8FZA5Dsmg6lXSHjfWhUt2yGtoL+T4YGskc2i0bcGsQ0TXP7b/mNM9 tNa4rdMIJNw+2SBJ4k5W7zu49aVjvBAED6ZrZ+zhCa4q1ap1SlHDFJ0JkLUzfjJu0yYI 8VlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=W2YwZ/OC+qrCGZ6ky0iGSWynUKcyYgVsTnESqnApOV0=; fh=/Aqzg51eNQmi2L7RUOUlPUcy5/p17/bUqT4vjvE+pNc=; b=TFWYvYgrIMNF/ZKSFmYw7bgmeukU8p6XhAU/o9t9THum7BB01EqtIh3iTY6Nu5FNMs Ht0ec4MZnCuS/7f9vBsYhmkFA9vNPWzMJ+j0prX+IMAZmbjyRmB1GhEibwuqxpDsHsMP nphv+Dl1uOhGEBrue17Q9H4Xmcu3kGahLSaMcLWCdXEqFv902wvhxOREm3BoXs3vGcar g+FIhU5Wh+nRJ7/19AdpcBH7z1oFFFrcLqTGym+Jo5mNyLgQINIYWHUXRlP0BlGDfcmT 95Ca4JSUJt4U3L4HqYNfNhQ2wbzUhO/umWw+XlyAenTokeaxqKwjrjS8jVjzdw8PQ3vw IW+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=enNFw54G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id n68-20020a634047000000b005b90fe4b5besi12162050pga.349.2023.11.28.04.35.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 04:35:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=enNFw54G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 00FE0804B039; Tue, 28 Nov 2023 04:35:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344178AbjK1MfY (ORCPT + 99 others); Tue, 28 Nov 2023 07:35:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344686AbjK1MfV (ORCPT ); Tue, 28 Nov 2023 07:35:21 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D78E10F7; Tue, 28 Nov 2023 04:35:25 -0800 (PST) Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ASCQHI2010187; Tue, 28 Nov 2023 12:35:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=W2YwZ/OC+qrCGZ6ky0iGSWynUKcyYgVsTnESqnApOV0=; b=enNFw54G4dAx5OWb28ZdP+Wjoz0TxhsC5+jjJcgyhkzH69IdxhBFNH4kOMBPr3SWlbB3 KYdLwvGRC9gqke3Sal2vZBI1gO9is3dIB9vEsjUkGatRlDxWJNn9XZYFJMCu22fPdPfk prDNWnJ/M5lZMNak+IZxWvKG+buIOgTca45NkMAvHvSIkwdvprqGHzhpt81UuJmmmSaE ftZP70qanShrX2BlovhNg9iQasHy73NLGBZiJ1Uvn5IOpfS26vpObYGt1j7l4E3GbVP3 AMUC4mK+6KlVqsH7t1h0qc7Z0eLOmTLxsUcb3Zd6UV3bOPyZ0H9TZygeN7oztfp90Y+c GA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3unfk01d60-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Nov 2023 12:35:18 +0000 Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3ASBhg34025897; Tue, 28 Nov 2023 12:35:18 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3unfk01d5q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Nov 2023 12:35:18 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3ASAR3f2018253; Tue, 28 Nov 2023 12:35:17 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ukwy1q2cw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Nov 2023 12:35:17 +0000 Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3ASCZHOd32899640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Nov 2023 12:35:17 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F2CAB58056; Tue, 28 Nov 2023 12:35:16 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 557E758052; Tue, 28 Nov 2023 12:35:16 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP; Tue, 28 Nov 2023 12:35:16 +0000 (GMT) Message-ID: Date: Tue, 28 Nov 2023 07:35:15 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 7/8] tpm: Add tpm_buf_read_{u8,u16,u32} Content-Language: en-US To: Jarkko Sakkinen , linux-integrity@vger.kernel.org Cc: linux-kernel@vger.kernel.org, James Bottomley , William Roberts , David Howells , Jason Gunthorpe , Mimi Zohar , Mario Limonciello , Jerry Snitselaar References: <20231124020237.27116-1-jarkko@kernel.org> <20231124020237.27116-8-jarkko@kernel.org> From: Stefan Berger In-Reply-To: <20231124020237.27116-8-jarkko@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: rP1408_SM3V8cG8L6CrC_155V6qQmkuY X-Proofpoint-GUID: bsfUcVzLwJuE12EumUqxacs0-ek95nM1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-28_12,2023-11-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 priorityscore=1501 phishscore=0 suspectscore=0 mlxlogscore=675 clxscore=1015 bulkscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311280100 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 28 Nov 2023 04:35:39 -0800 (PST) On 11/23/23 21:02, Jarkko Sakkinen wrote: > Declare reader functions for the instances of struct tpm_buf. If the read > goes out of boundary, TPM_BUF_BOUNDARY_ERROR is set, and subsequent read > will do nothing. > > Signed-off-by: Jarkko Sakkinen > --- > + */ > +u16 tpm_buf_read_u16(struct tpm_buf *buf, off_t *offset) > +{ > + u16 value; This should be __be16 ... > + > + tpm_buf_read(buf, offset, sizeof(value), &value); > + > + return be16_to_cpu(value); > +} > +EXPORT_SYMBOL_GPL(tpm_buf_read_u16); > + > +/** > + * tpm_buf_read_u32() - Read 32-bit word from a TPM buffer > + * @buf: &tpm_buf instance > + * @offset: offset within the buffer > + * > + * Return: next 32-bit word > + */ > +u32 tpm_buf_read_u32(struct tpm_buf *buf, off_t *offset) > +{ > + u32 value; ... and this __be32 to avoid this here: drivers/char/tpm/tpm-buf.c:203:16: warning: cast to restricted __be16 drivers/char/tpm/tpm-buf.c:220:16: warning: cast to restricted __be32