From patchwork Thu Nov 5 16:19:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 540511 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0876C1409C3 for ; Fri, 6 Nov 2015 03:19:58 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1ZuNGT-0006qy-2Z; Thu, 05 Nov 2015 16:19:53 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1ZuNGS-0006qt-KE for tpmdd-devel@lists.sourceforge.net; Thu, 05 Nov 2015 16:19:52 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of ts.fujitsu.com designates 80.70.172.51 as permitted sender) client-ip=80.70.172.51; envelope-from=martin.wilck@ts.fujitsu.com; helo=dgate20.ts.fujitsu.com; Received: from dgate20.ts.fujitsu.com ([80.70.172.51]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1ZuNGM-0004YT-Ix for tpmdd-devel@lists.sourceforge.net; Thu, 05 Nov 2015 16:19:52 +0000 X-SBRSScore: None Received: from unknown (HELO abgdate50u.abg.fsc.net) ([172.25.138.66]) by dgate20u.abg.fsc.net with ESMTP; 05 Nov 2015 17:19:29 +0100 Received: from unknown (HELO pdbcooper.pdb.fsc.net) ([172.25.111.126]) by abgdate50u.abg.fsc.net with ESMTP; 05 Nov 2015 17:19:29 +0100 Received: from pdbcooper.pdb.fsc.net (localhost [127.0.0.1]) by pdbcooper.pdb.fsc.net (8.14.9/8.14.8) with ESMTP id tA5GJNFm015280; Thu, 5 Nov 2015 17:19:24 +0100 From: martin.wilck@ts.fujitsu.com To: tpmdd-devel@lists.sourceforge.net Date: Thu, 5 Nov 2015 17:19:13 +0100 Message-Id: <1446740353-15235-7-git-send-email-martin.wilck@ts.fujitsu.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1446740353-15235-1-git-send-email-martin.wilck@ts.fujitsu.com> References: <1446740353-15235-1-git-send-email-martin.wilck@ts.fujitsu.com> X-Spam-Score: -1.6 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1ZuNGM-0004YT-Ix Cc: Martin Wilck Subject: [tpmdd-devel] [PATCH 6/6] tpm: fix calculation of ordinal duration X-BeenThere: tpmdd-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Tpm Device Driver maintainance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: tpmdd-devel-bounces@lists.sourceforge.net From: Martin Wilck commit 07b133e6060b ("char/tpm: simplify duration calculation and eliminate smatch warning.") separated out the high bits from the duration calculation for ordinals but forgot to actually mask them out when looking at the ordinal index. Fix it. Signed-off-by: Martin Wilck --- drivers/char/tpm/tpm-interface.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index c50637d..e4bceba 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -312,6 +312,7 @@ unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, int duration = 0; u8 category = (ordinal >> 24) & 0xFF; + ordinal &= 0xFFFF; /* command ordinal index - low 16 bits */ if ((category == TPM_PROTECTED_COMMAND && ordinal < TPM_MAX_ORDINAL) || (category == TPM_CONNECTION_COMMAND && ordinal < TSC_MAX_ORDINAL)) duration_idx = tpm_ordinal_duration[ordinal];