Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp186485imu; Thu, 8 Nov 2018 06:57:34 -0800 (PST) X-Google-Smtp-Source: AJdET5fogA9oK45aRebYiWoCBirUdUbV5DRAwgodXU4qfhQZ12DrjjzjTT1A1Jrd6qV8HIjtnvQo X-Received: by 2002:a17:902:107:: with SMTP id 7-v6mr4892926plb.267.1541689054893; Thu, 08 Nov 2018 06:57:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541689054; cv=none; d=google.com; s=arc-20160816; b=q80egvGgYmu9jBD+ZtyJIBJThI+7rKFvi/eCYU8Z+eAfij+uws/OG5EF0/4xmoUzPU QBiNaURhjMXuUVpBeztRhftY6UCZ0HvSqHu3u0X4OSokPuc2wYFkpBTjOnU6GQMNM8tC sP9floJjz0/YSyS+mop2hAflooJfQ06zyLzneZ52Olo0ggbEmuS11vJDsYRWLtv5VZKl MOKNF9bkyzXCwyH44IQgK0hzfgmmShSzD8HmImfF1cSJ3AbKVH9/edoZevBqRwC8xL+d PpNxVF/arUgqvCCCiEr3ZU0Pw+v2u/ju/rRPaO5Yf42gw8FnW0pAlL3eqj/9tqCB+AqN 1mew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:cc:to:subject; bh=3A58GBOB2d9yUbqSnm/OeoyDKkZJie+CYB+Qnyj3Pic=; b=rJHp1jd/q19wczRikmlYrfccKxlZ6daqMQIlOmJsIItcO1YoTrWJuTwUO7rykcEutT ifQyrgo9VRSNM+R0tGObWya/ooweJhUw5sdUh4mCZ1TriQKjFLow1YzVVPhtMr11r1dn hxEFOPOFkZA+hje6zXa3FrC0bWR3ZdLI6fMZUrOLUIy8ESij3IoqwfrPo5kX/w/7d+Qo +87XrzcGZSMAwkw+/hWqOkFblzWjKj4235lagvSB8vgQvJ3RZApiLNqCPFr4NJphWAbF t34l9xlJUT8ONp08Y7dITv4bTkzEZJ2YR2hnd139JmsJUk75LNTHZDrWRLCGqrkGT4gT 4F3g== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 19-v6si5123404pfb.113.2018.11.08.06.57.19; Thu, 08 Nov 2018 06:57:34 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726780AbeKIAch (ORCPT + 99 others); Thu, 8 Nov 2018 19:32:37 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:46930 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726583AbeKIAch (ORCPT ); Thu, 8 Nov 2018 19:32:37 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wA8Et1Ze193452 for ; Thu, 8 Nov 2018 09:56:43 -0500 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0b-001b2d01.pphosted.com with ESMTP id 2nmpcru4af-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 08 Nov 2018 09:56:43 -0500 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Nov 2018 14:56:39 -0000 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 8 Nov 2018 14:56:35 -0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wA8EuYxr35586254 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Nov 2018 14:56:34 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AEDDDB2064; Thu, 8 Nov 2018 14:56:34 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7F917B2066; Thu, 8 Nov 2018 14:56:34 +0000 (GMT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 8 Nov 2018 14:56:34 +0000 (GMT) Subject: Re: [PATCH v5 05/17] tpm: print tpm2_commit_space() error inside tpm2_commit_space() To: Jarkko Sakkinen , linux-integrity@vger.kernel.org Cc: linux-security-module@vger.kernel.org, James Bottomley , Tomas Winkler , Tadeusz Struk , Stefan Berger , Nayna Jain , Peter Huewe , Jason Gunthorpe , Arnd Bergmann , Greg Kroah-Hartman , open list References: <20181108141541.12832-1-jarkko.sakkinen@linux.intel.com> <20181108141541.12832-6-jarkko.sakkinen@linux.intel.com> From: Stefan Berger Date: Thu, 8 Nov 2018 09:56:34 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20181108141541.12832-6-jarkko.sakkinen@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-MW X-TM-AS-GCONF: 00 x-cbid: 18110814-2213-0000-0000-00000313A346 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010008; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01114487; UDB=6.00577813; IPR=6.00894586; MB=3.00024075; MTD=3.00000008; XFM=3.00000015; UTC=2018-11-08 14:56:38 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18110814-2214-0000-0000-00005C2F1F88 Message-Id: <32b1c364-2231-a740-8dbb-3cbbff490aca@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-08_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1811080127 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/8/18 9:15 AM, Jarkko Sakkinen wrote: > The error logging for tpm2_commit_space() is in a wrong place. This > commit moves it inside that function. > > Signed-off-by: Jarkko Sakkinen Reviewed-by: Stefan Berger > --- > drivers/char/tpm/tpm-interface.c | 8 ++------ > drivers/char/tpm/tpm2-space.c | 9 ++++++--- > 2 files changed, 8 insertions(+), 9 deletions(-) > > diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c > index c9efd1b9fd2c..7ffb16edab6f 100644 > --- a/drivers/char/tpm/tpm-interface.c > +++ b/drivers/char/tpm/tpm-interface.c > @@ -268,14 +268,10 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip, > rc = -EFAULT; > > out_space: > - if (rc) { > + if (rc) > tpm2_flush_space(chip); > - } else { > + else > rc = tpm2_commit_space(chip, space, ordinal, buf, &len); > - if (rc) > - dev_err(&chip->dev, "tpm2_commit_space: error %d\n", > - rc); > - } > > out_idle: > /* may fail but do not override previous error value in rc */ > diff --git a/drivers/char/tpm/tpm2-space.c b/drivers/char/tpm/tpm2-space.c > index d53c882268ff..3d5f9577e5de 100644 > --- a/drivers/char/tpm/tpm2-space.c > +++ b/drivers/char/tpm/tpm2-space.c > @@ -501,19 +501,19 @@ int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space, > rc = tpm2_map_response_header(chip, cc, buf, *bufsiz); > if (rc) { > tpm2_flush_space(chip); > - return rc; > + goto out; > } > > rc = tpm2_map_response_body(chip, cc, buf, *bufsiz); > if (rc) { > tpm2_flush_space(chip); > - return rc; > + goto out; > } > > rc = tpm2_save_space(chip); > if (rc) { > tpm2_flush_space(chip); > - return rc; > + goto out; > } > > *bufsiz = be32_to_cpu(header->length); > @@ -526,4 +526,7 @@ int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space, > memcpy(space->session_buf, chip->work_space.session_buf, PAGE_SIZE); > > return 0; > +out: > + dev_err(&chip->dev, "%s: error %d\n", __func__, rc); > + return rc; > }