From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarkko Sakkinen Subject: Re: [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces Date: Thu, 12 Jan 2017 22:31:22 +0200 Message-ID: <20170112203122.y72a46b5d3dbbd6b@intel.com> References: <20170112174612.9314-1-jarkko.sakkinen@linux.intel.com> <20170112174612.9314-4-jarkko.sakkinen@linux.intel.com> <1484246310.2417.15.camel@HansenPartnership.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1484246310.2417.15.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: James Bottomley Cc: linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, open list List-Id: tpmdd-devel@lists.sourceforge.net On Thu, Jan 12, 2017 at 10:38:30AM -0800, James Bottomley wrote: > 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. Yeah, would make sense. > James /Jarkko ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751053AbdALUbj (ORCPT ); Thu, 12 Jan 2017 15:31:39 -0500 Received: from mga09.intel.com ([134.134.136.24]:46751 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750733AbdALUbh (ORCPT ); Thu, 12 Jan 2017 15:31:37 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,219,1477983600"; d="scan'208";a="52345438" Date: Thu, 12 Jan 2017 22:31:22 +0200 From: Jarkko Sakkinen To: James Bottomley Cc: tpmdd-devel@lists.sourceforge.net, open list , linux-security-module@vger.kernel.org Subject: Re: [tpmdd-devel] [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces Message-ID: <20170112203122.y72a46b5d3dbbd6b@intel.com> References: <20170112174612.9314-1-jarkko.sakkinen@linux.intel.com> <20170112174612.9314-4-jarkko.sakkinen@linux.intel.com> <1484246310.2417.15.camel@HansenPartnership.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1484246310.2417.15.camel@HansenPartnership.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.6.2-neo (2016-08-21) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 12, 2017 at 10:38:30AM -0800, James Bottomley wrote: > 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. Yeah, would make sense. > James /Jarkko