Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp934304imm; Wed, 10 Oct 2018 06:39:49 -0700 (PDT) X-Google-Smtp-Source: ACcGV61wtDAMFsFmXWvaJUyUHDOWD4MNHVOAwprRTcQBYwHR+nn+XjVwVxcTwJpZ83dKUuT0EGU5 X-Received: by 2002:a65:4103:: with SMTP id w3-v6mr30359136pgp.284.1539178789246; Wed, 10 Oct 2018 06:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539178789; cv=none; d=google.com; s=arc-20160816; b=a1L2Sfj7KBzzYS32+zJEso1xmgMpexyUphawjLDIZz8Ns1odQ05yln7NtLNsOrbgLE 2XiEVCNvd/yM6hJkZ9Nx1BUqwqGJXSC57msl58EFWTFlaJdnZVE0aAGXCWVclZBlWq5d W43qUso4lNvM7UgnS6g4YSACAB+SHt19N4aWuXoyUEjNRfCtSV9TRV30jrCS+/5NG6H3 WwV12pY/+lMIZ/ucyvf2MIL7WRrvl5Fel0uYbJm/tyjc1w6e15u6k+Z1e9sg2Dko9Gfv fsCkexzV8Tp4b3tb6ass0efD/VdL1axnGggQ5UyMKHWQ5ySOebnrJsfLpxt5/ITrY7Vt +7hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=BG+mnUBn/EYVVQvT6yl6YEnDjTwM03I0GqoxF1GQWHA=; b=LDUMu+kHVuqxf407VyLf1I1FSDvMahaPiBLZNsJh0NflgLaIwt99e/zyVKpZpFNoXm S99loL9js+bcs7I1u0xe1g9rbyGr15YNMkuiPiNWur+Bpg+BjAblk7EhUjH2gWUqVAIp 9yWRUR80voSe4bX4VoTeyCrhlcUgUERE6iffifyPhbPv3fk0UVH0lYh9J0ujCakuDdEV uCr1IYFtxZfUFF/vhroX48fYMA9wDvk6TYitAbt2Hwr8h0q+FWTMExGBAkAGwcESw0H2 8cN5Ep3mNmi3GoQtc+qUwBRYovREGuUtWIX9nwqAG8XPZ6JS0s+LFsb+V+krP1uX14PA RuIQ== 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 z127-v6si26025779pgb.455.2018.10.10.06.39.34; Wed, 10 Oct 2018 06:39:49 -0700 (PDT) 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 S1726990AbeJJVAz (ORCPT + 99 others); Wed, 10 Oct 2018 17:00:55 -0400 Received: from gateway24.websitewelcome.com ([192.185.51.209]:23653 "EHLO gateway24.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726713AbeJJVAz (ORCPT ); Wed, 10 Oct 2018 17:00:55 -0400 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway24.websitewelcome.com (Postfix) with ESMTP id BF4A4367690 for ; Wed, 10 Oct 2018 08:38:41 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id AEgugAgH08YaUAEh7gcHxT; Wed, 10 Oct 2018 08:38:41 -0500 X-Authority-Reason: nr=8 Received: from 57.154.24.109.rev.sfr.net ([109.24.154.57]:46920 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1gAEgt-003GNv-Gw; Wed, 10 Oct 2018 08:38:19 -0500 Date: Wed, 10 Oct 2018 15:38:17 +0200 From: "Gustavo A. R. Silva" To: Tomas Winkler , Peter Huewe , Jarkko Sakkinen , Jason Gunthorpe , Arnd Bergmann , Greg Kroah-Hartman Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] tpm: fix unused-value issues in tpm_try_transmit Message-ID: <20181010133817.GA11485@embeddedor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 109.24.154.57 X-Source-L: No X-Exim-ID: 1gAEgt-003GNv-Gw X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 57.154.24.109.rev.sfr.net (embeddedor) [109.24.154.57]:46920 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 8 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, there are some values assigned to variable *rc*, which are never actually used in any computation, because such variable is updated at line 550, before they can be used: 549out: 550 rc = tpm_go_idle(chip, flags); 551 if (rc) 552 goto out; Fix this by removing such assignments. Addresses-Coverity-ID: 1470245 ("Unused value") Addresses-Coverity-ID: 1470250 ("Unused value") Addresses-Coverity-ID: 1470251 ("Unused value") Fixes: 627448e85c76 ("tpm: separate cmd_ready/go_idle from runtime_pm") Signed-off-by: Gustavo A. R. Silva --- drivers/char/tpm/tpm-interface.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index 129f640..8062736 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -512,7 +512,6 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip, if (chip->ops->req_canceled(chip, status)) { dev_err(&chip->dev, "Operation Canceled\n"); - rc = -ECANCELED; goto out; } @@ -522,7 +521,6 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip, chip->ops->cancel(chip); dev_err(&chip->dev, "Operation Timed out\n"); - rc = -ETIME; goto out; out_recv: @@ -533,14 +531,12 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip, "tpm_transmit: tpm_recv: error %d\n", rc); goto out; } else if (len < TPM_HEADER_SIZE) { - rc = -EFAULT; goto out; } - if (len != be32_to_cpu(header->length)) { - rc = -EFAULT; + if (len != be32_to_cpu(header->length)) goto out; - } + rc = tpm2_commit_space(chip, space, ordinal, buf, &len); if (rc) -- 2.7.4