Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5296044imu; Tue, 13 Nov 2018 04:28:41 -0800 (PST) X-Google-Smtp-Source: AJdET5eHBf+w5bwWFa2e8hM4dxSPkzF34NK9Sz9OJljSD44Kb2wbUhHBXfULCB1QtF7qvJCdoR2N X-Received: by 2002:a63:4e15:: with SMTP id c21mr4603023pgb.50.1542112121630; Tue, 13 Nov 2018 04:28:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542112121; cv=none; d=google.com; s=arc-20160816; b=spk0vFNF29UYV8qwZqReZFpUa8467LClTadnFSLvrM3Csbbo3DBZiO/EgL3xg2SeRW Z1TZQ1IpWwFHMN9b+SyYxVs8gmi2ozTDOj3O8RwYPHNfhOlbBOdvhd7/P1jDC3IPcC6o tPksJObYGAzS7BDkRFtyOgMDGcI9W8gZQe3IQJXoWala8TQnXpAZhZtu6j8tv9rwOA9e cJqh1IpWddRRMhR/hpOROWVCYbJbdwXX41ezgYoUXtGrEReYvyji9BMLAHLpIbug5dJj 9dt3FZ1sVOI1fPX23kmIsN4FmUklYfV1wGzCpMXr+QevGukRGWHr7A3QjcJW5JokEGum taeg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=INCc0OjaZv8gKdMnxekU+DWvK+as9cvIE3Ckzhw2/Ws=; b=UmwByk5TDTiwaa+YmvDqVbHlefwwfnkIOJ5yQYk7gR7BPXfweWIly2AIoo+X4PnFq7 FBXLY9++NHwbqq27AUK/sxzhjrfYiug3cMY8oL9htHuozcx0xPDDCp46Ui9Bp/FrXm8Y Du33VZ7xIFiMV2sllbLii5VcgmTzjzqi7RdDEQG9dFqnRn3o3/Axe8cIgDJk2cfj92nx eQAIEC6LYmIUQK76kHOQDSBEYFMhunArOKUBS3Yz3Q0kwU4wCgy8gNWbV1lcLhO+S+tZ FGBXOwc0/M4tYaxo3n3unS4xnQDTWczvBZizY2Sy/pT2GSuWYNq/XYeawvG4yWHAUtuC G90g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b131si19743868pga.51.2018.11.13.04.28.24; Tue, 13 Nov 2018 04:28:41 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733157AbeKMWZ0 (ORCPT + 99 others); Tue, 13 Nov 2018 17:25:26 -0500 Received: from mga18.intel.com ([134.134.136.126]:39529 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732816AbeKMWZZ (ORCPT ); Tue, 13 Nov 2018 17:25:25 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2018 04:27:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,499,1534834800"; d="scan'208";a="108176580" Received: from ibanaga-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.254.77]) by orsmga002.jf.intel.com with ESMTP; 13 Nov 2018 04:27:24 -0800 From: Jarkko Sakkinen To: linux-integrity@vger.kernel.org Cc: linux-security-module@vger.kernel.org, James Bottomley , Tomas Winkler , Tadeusz Struk , Stefan Berger , Nayna Jain , Jarkko Sakkinen , Peter Huewe , Jason Gunthorpe , Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v6 08/17] tpm: access command header through struct in tpm_try_transmit() Date: Tue, 13 Nov 2018 14:25:57 +0200 Message-Id: <20181113122609.21643-9-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113122609.21643-1-jarkko.sakkinen@linux.intel.com> References: <20181113122609.21643-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of accessing fields of the command header through offsets to the raw buffer, it is a better idea to use the header struct pointer that is already used elsewhere in the function. Signed-off-by: Jarkko Sakkinen Reviewed-by: Stefan Berger --- drivers/char/tpm/tpm-interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index 6abbcedc87a3..f2280bf15339 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -190,8 +190,8 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip, if (bufsiz > TPM_BUFSIZE) bufsiz = TPM_BUFSIZE; - count = be32_to_cpu(*((__be32 *) (buf + 2))); - ordinal = be32_to_cpu(*((__be32 *) (buf + 6))); + count = be32_to_cpu(header->length); + ordinal = be32_to_cpu(header->ordinal); if (count == 0) return -ENODATA; if (count > bufsiz) { -- 2.19.1