From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750957AbdALSjt (ORCPT ); Thu, 12 Jan 2017 13:39:49 -0500 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:36670 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750974AbdALSig (ORCPT ); Thu, 12 Jan 2017 13:38:36 -0500 Message-ID: <1484246310.2417.15.camel@HansenPartnership.com> Subject: Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces From: James Bottomley To: Jarkko Sakkinen , tpmdd-devel@lists.sourceforge.net Cc: open list , linux-security-module@vger.kernel.org Date: Thu, 12 Jan 2017 10:38:30 -0800 In-Reply-To: <20170112174612.9314-4-jarkko.sakkinen@linux.intel.com> References: <20170112174612.9314-1-jarkko.sakkinen@linux.intel.com> <20170112174612.9314-4-jarkko.sakkinen@linux.intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > @@ -435,17 +440,23 @@ ssize_t tpm_transmit(struct tpm_chip *chip, > const u8 *buf, size_t bufsiz, > goto out; > > out_recv: > - rc = chip->ops->recv(chip, (u8 *) buf, bufsiz); > - if (rc < 0) > + len = chip->ops->recv(chip, (u8 *) buf, bufsiz); > + if (len < 0) { > dev_err(&chip->dev, > - "tpm_transmit: tpm_recv: error %zd\n", rc); > + "tpm_transmit: tpm_recv: error %d\n", rc); > + rc = len; > + goto out; > + } > + > + rc = tpm2_commit_space(chip, space, ordinal, buf, bufsiz); I think this should be rc = tpm2_commit_space(chip, space, ordinal, buf, len) because tpm2_commit_space wants to know the length of the response, not the length of the original command. James