Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2731499rda; Wed, 25 Oct 2023 10:36:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSti6DHVW9eK9h/crqG104ex5GWX5h/DfE3RfGwjiW21QIhPgayr1aKc/+1WzrSjB88xgE X-Received: by 2002:a81:b108:0:b0:5a7:fbac:4ffe with SMTP id p8-20020a81b108000000b005a7fbac4ffemr505273ywh.22.1698255410941; Wed, 25 Oct 2023 10:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698255410; cv=none; d=google.com; s=arc-20160816; b=CcjbZLkHqSdAfNy2nAsuk4+oCnJlTuacmsA85R9honxhirF3g1s3pPxFL4mvxZi9w5 g4tzCo3+IEVTuCrnXoNxtyw/sCVPKPTQAdAe+tfbRm2fwBVeT7wpN75O3WZGeX7DRzU+ W7Y1lkmimy2B8EoBd1DeDhg9NN2DBnQ9z2houG/SlMWFI+OvWoKcqafKv7//+VIQdz9c HyXry2avhoood0PQDdR4N0d+P4x/hcQB6TYWwZ7sdJ2YRt4TQCyEUfrcYD1phWu1HWwL HK96mI01s7xtEzeUwufKTNKUs9iWP4rVs/J6H1ODGml5ccOld9LmWV3WABhaXQie/glV Dptg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:to:from:subject:cc :message-id:date:content-transfer-encoding:mime-version :dkim-signature; bh=+sRFH9UuPJw4cOs4GDPzzVdEMhSpovQbPYtq4U6q+MU=; fh=+lvd4ZjlLWvldytIbuSsiVyREIN/mPwlKBAvnw6Y8Tk=; b=Ue/R6oLzy/nom8o+f1z4qKsnUzfIK0u7UnaD3ael6Om564Ki1pxRd4uRJMmWF4dnFo K169jCdQoc7NpSTxPPDRCm9DfBUPWyi2ZNz1OBG92zRAYHP5zBBQN7x6Wo1OMvatrKsd j6NEJ7IBSYrTaH39dRnyCiiyv9i39f4k9asTleHwaiEsdHNCI/r9ssjUe7CJ6ixQ7I/D 5RTVhl4eLJic7xb0oZ+1Vd25E8j6sCnkiGmkMXK+vaRqO9lIAnnp5jI+Pv5s35SdgNGR OyuvWfYsDPnZOid7v7eHXv0IFcOrvyhGj3ZS8Di5sL6Tt/rfDBoepv4JP8H1+pAAP2D3 rOmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lj+Ip072; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id q188-20020a0dcec5000000b005a7e46262e7si10615352ywd.375.2023.10.25.10.36.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 10:36:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lj+Ip072; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E85A480241B5; Wed, 25 Oct 2023 10:36:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233381AbjJYRgO (ORCPT + 99 others); Wed, 25 Oct 2023 13:36:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234524AbjJYRgC (ORCPT ); Wed, 25 Oct 2023 13:36:02 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F8D6183; Wed, 25 Oct 2023 10:36:00 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3551DC433C8; Wed, 25 Oct 2023 17:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698255359; bh=76zTKwswmBirf1LCqHxQmnoZ+6FzNZDOXE/gwyujFsM=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=lj+Ip072aXzpoqSgPyMhTHwAuLFysevZmOBAkVx+ZMK32rMbctOB7YPlz6oRtA03Z 8ppvmdIo6hyxLCIfUvvmJNKOTxyLIKOdf+42c6zSVzjKetK0JYlDSuFleOSKfbqQ8D vxklxPt/SCMuhC27qPxyKNHB1eRkdTZGlzFr39OheOmwtnOFcxWxAFmiVSNiP4ZV6j 3IjftZ2yz/lkmkGuaKimR5kmtsJDYaVJigdbpshaFaiEzap1h6eodxqq/gk8N3hrC8 8BuiBgQzMWV08SM9MB9JtYWCjYYebLFT5FAe587OskyVpLphNWtvtcc3EJ5VuF0XXa 8FVxtfbgdabhA== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 25 Oct 2023 20:35:55 +0300 Message-Id: Cc: , , "James Bottomley" , "William Roberts" , "Stefan Berger" , "David Howells" , "Jason Gunthorpe" , "Mimi Zohar" , "Peter Huewe" , "Mario Limonciello" , "Julien Gomes" , "open list" Subject: Re: [PATCH v3 1/6] tpm: Move buffer handling from static inlines to real functions From: "Jarkko Sakkinen" To: "Jerry Snitselaar" X-Mailer: aerc 0.15.2 References: <20231024011531.442587-1-jarkko@kernel.org> <20231024011531.442587-2-jarkko@kernel.org> In-Reply-To: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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 (howler.vger.email [0.0.0.0]); Wed, 25 Oct 2023 10:36:25 -0700 (PDT) On Wed Oct 25, 2023 at 12:03 PM EEST, Jerry Snitselaar wrote: > Reviewed-by: Jerry Snitselaar On Wed, 2023-10-25 at 02:03 -0700, Jerry Snitselaar wrote: > Reviewed-by: Jerry Snitselaar > Thanks I'll add it to the next round. For the tpm_buf_read(), I was thinking along the lines of: /** * tpm_buf_read() - Read from a TPM buffer * @buf: &tpm_buf instance * @pos: position within the buffer * @count: the number of bytes to read * @output: the output buffer * * Read bytes from a TPM buffer, and update the position. Returns false whe= n the * amount of bytes requested would overflow the buffer, which is expected t= o * only happen in the case of hardware failure. */ static bool tpm_buf_read(const struct tpm_buf *buf, off_t *pos, size_t coun= t, void *output) { off_t next =3D *pos + count; if (next >=3D buf->length) { pr_warn("%s: %lu >=3D %lu\n", __func__, next, *offset); return false; } memcpy(output, &buf->data[*pos], count); *offset =3D next; return true; } BR, Jarkko