Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1575594imu; Sun, 18 Nov 2018 04:49:18 -0800 (PST) X-Google-Smtp-Source: AJdET5eaUrTc39o/04y2eEmI12X5F+2QIxVrqlFuZlL6ep97c645PPTegCeUjbKTnvJTcJaV52PX X-Received: by 2002:a63:b218:: with SMTP id x24mr16040852pge.223.1542545358648; Sun, 18 Nov 2018 04:49:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542545358; cv=none; d=google.com; s=arc-20160816; b=B2zPl/1DEaRJn0YMT1oKlpwYbUta8UytJoNzMbeKly3GbrovhCvCqMpd406+8aFVxv 4Zb1xW0R7BKtUjTdxau6U02z7lfR8bKOChOsRYkJTyTXln6rW5ipSdbrLInxXeiY+2nB vZKomSFHXDkscokpYSJW/Oe/VpRIc6iz29ia7yy/EWDxXkf5J683ALnoaQO9vrO6Hczx 6/kZZ1M1DWFTkl4bBceP5csANUMo11ok9AfPNutTXmD2eNZ1tnrz0ZgnzGlx0kqaH139 jQGAkWG+KiPjgvtz2FDGrq5wkW4uqF7BDvnO6/LiiUUC+osXkk+SuirZYZ4jYMD1UAat uF0w== 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=3HIiEGtR8GRmeB+vuXapnpoxBP4UlFhrPc9wflmeDfc=; b=tKNT8tVf2aOAURsiNSqdokPuIqL08t6xvayqh+nsBwfw4op+YMBw+jgmelDyc/nkqN 37KSNviXXOPhIBHKyqO5jKFWiDeVl2yTaHeseEhYmB1XsDKonOQk5TYXLSRyNgzDi4L/ a0kc2CJ2N+0fV5MVQbCKnJpj7yYSMgcpArI/y6CFZJDbjfsKdIT/xVgySdd+KUZ3GfID wymYPMVZzhFPijQPYGJRh8WWFkpl0KnzDaCV+ajoJiMmRmTLEjIxDXWo3/vLGxcCTTaZ Spwlh2TP/zNP8GxZHztJWaziUODkJE8yCb3YfmNwzNeKWN9/AOL2QjK5k4wT0R9a4AyY 9bgA== 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 v6si23758397pfj.167.2018.11.18.04.49.03; Sun, 18 Nov 2018 04:49:18 -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 S1727342AbeKRXId (ORCPT + 99 others); Sun, 18 Nov 2018 18:08:33 -0500 Received: from mga01.intel.com ([192.55.52.88]:25738 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726180AbeKRXId (ORCPT ); Sun, 18 Nov 2018 18:08:33 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Nov 2018 04:48:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,248,1539673200"; d="scan'208";a="107258472" Received: from tmuluk-mobl4.ger.corp.intel.com (HELO localhost) ([10.249.254.142]) by fmsmga004.fm.intel.com with ESMTP; 18 Nov 2018 04:48:13 -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 v9 02/17] tpm: fix invalid return value in pubek_show() Date: Sun, 18 Nov 2018 14:47:35 +0200 Message-Id: <20181118124753.18613-3-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181118124753.18613-1-jarkko.sakkinen@linux.intel.com> References: <20181118124753.18613-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 --- 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