Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5599714ima; Tue, 5 Feb 2019 14:48:30 -0800 (PST) X-Google-Smtp-Source: AHgI3IZr7GgxCwVLO8Kg7rAByYl8Quylc1+r0mq90XCfsdITYF6TEJo4Cmjs4R1Reo7V/R7LsY/q X-Received: by 2002:a17:902:33c1:: with SMTP id b59mr7438715plc.220.1549406910539; Tue, 05 Feb 2019 14:48:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549406910; cv=none; d=google.com; s=arc-20160816; b=M66RS8CokqdG7SKYE7e+/+ZzYt7Dg1IoGyECqVaM5hw0p0RkCiWjNOvihzSgsJ5kd7 11wvnml8Tzt0ucVZmjmx+EDk9Z6UbnwfdIRmqyz1oWiwfIs42vYKODY0XzuEfE8OIDLb 62oHDTnb1PxmOWp4+mvmpIMdNtYed60B05DWE4dUk5aWq99VlrpHhIS7jMV3FUlhHbwG 5Spy7sSjv0/H2I49qSmIfjXnbqtOh2BiyCeR2PuXhKMjmWEcxq10fUbI7qatHnftroQV VBVenACld6KJNTRDH/pb/bdFQUrQ+XPmHNs7PENSpGTQ9Y1F6Ms7hFzkwjUmUNsTRuqE PV3A== 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=33slLyeEAlBCV0/DoDFHfVkdwrdTOcae5koV0zQOChY=; b=JailfBpEXv7XUZHyU8Wc3OJcSDcMCYmOiF+OKUoE3SoHpFtOX18oKpzy168oBOvhZ3 bA21azxzXUZQ9uwNst6U3jO3Qq4xGzKutG5CNUdTnbvq0vayiNFi3D4J+vvV7AkSz3Lu JFzXssfYOR160b1077MF5XVi/2NIvtUDV1WYfUBc+iQ7+mF+bt+Av2z70mQmB9lx/QMH aliWH1+cZgz7tQGl6K8nDt4u0Pg2vwK7I6+BN0OcSF5uyhalBNaoRy3FdiibvIZS+e3n gT/dUOmrPr9elAa3WfmHYlNG9BXZhmP8L2QlZ74IWIEhpNwoTj/hMIwb1wjO6bwljNse thnA== 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 e2si1813471pgf.53.2019.02.05.14.48.15; Tue, 05 Feb 2019 14:48:30 -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 S1730739AbfBEWrt (ORCPT + 99 others); Tue, 5 Feb 2019 17:47:49 -0500 Received: from mga17.intel.com ([192.55.52.151]:61879 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730724AbfBEWrr (ORCPT ); Tue, 5 Feb 2019 17:47:47 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Feb 2019 14:47:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,337,1544515200"; d="scan'208";a="113982093" Received: from ibanaga-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.254.171]) by orsmga006.jf.intel.com with ESMTP; 05 Feb 2019 14:47:42 -0800 From: Jarkko Sakkinen To: linux-integrity@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Peter Huewe , Jason Gunthorpe , Tomas Winkler , Tadeusz Struk , Stefan Berger , Nayna Jain , Jarkko Sakkinen Subject: [PATCH v11 02/16] tpm: fix invalid return value in pubek_show() Date: Wed, 6 Feb 2019 00:47:09 +0200 Message-Id: <20190205224723.19671-3-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190205224723.19671-1-jarkko.sakkinen@linux.intel.com> References: <20190205224723.19671-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 Return zero when tpm_buf_init() fails as we do for other functions in tpm-sysfs.c. Fixes: da379f3c1db0c ("tpm: migrate pubek_show to struct tpm_buf") Signed-off-by: Jarkko Sakkinen Reviewed-by: Stefan Berger Tested-by: Stefan Berger Reviewed-by: Jerry Snitselaar Reviewed-by: James Bottomley --- drivers/char/tpm/tpm-sysfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c index c2769e55cb6c..7ed7eb6f906a 100644 --- a/drivers/char/tpm/tpm-sysfs.c +++ b/drivers/char/tpm/tpm-sysfs.c @@ -47,9 +47,8 @@ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr, memset(&anti_replay, 0, sizeof(anti_replay)); - rc = tpm_buf_init(&tpm_buf, TPM_TAG_RQU_COMMAND, TPM_ORD_READPUBEK); - if (rc) - return rc; + if (tpm_buf_init(&tpm_buf, TPM_TAG_RQU_COMMAND, TPM_ORD_READPUBEK)) + return 0; tpm_buf_append(&tpm_buf, anti_replay, sizeof(anti_replay)); -- 2.19.1