From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751605AbdBCSPj (ORCPT ); Fri, 3 Feb 2017 13:15:39 -0500 Received: from mga02.intel.com ([134.134.136.20]:34099 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750863AbdBCSP2 (ORCPT ); Fri, 3 Feb 2017 13:15:28 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,329,1477983600"; d="scan'208";a="60885188" Date: Fri, 3 Feb 2017 20:15:23 +0200 From: Jarkko Sakkinen To: Nayna Cc: tpmdd-devel@lists.sourceforge.net, open list , linux-security-module@vger.kernel.org Subject: Re: [tpmdd-devel] [PATCH] tpm: fix type issues in tpm_getcap() Message-ID: <20170203181523.mu4hqhb7epqmthfd@intel.com> References: <20170201175347.2035-1-jarkko.sakkinen@linux.intel.com> <58947D8E.20000@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <58947D8E.20000@linux.vnet.ibm.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 Fri, Feb 03, 2017 at 06:24:38PM +0530, Nayna wrote: > > > On 02/01/2017 11:23 PM, Jarkko Sakkinen wrote: > > There are two type issues associated with tpm_getcap(). > > > > You must not do arithmetic with __be32 or __le32 types because sometimes > > it results incorrect results. Calculations must be done only with data > > that is in CPU byte order. This commit migrates tpm_getcap() to struct > > tpm_buf in order to sort out these issues. > > > > The second issue is with struct cap_t as the size of the type bool is > > assumed to be one byte. This commit sorts out the issue by changing the > > type to u8. > > > > Signed-off-by: Jarkko Sakkinen > > --- > > v2: > > - Use struct tpm_buf. > > - Merge the type change of 'owned' to this patch. > > drivers/char/tpm/tpm-interface.c | 33 ++++++++++++++++++--------------- > > drivers/char/tpm/tpm.h | 15 +-------------- > > 2 files changed, 19 insertions(+), 29 deletions(-) > > > > diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c > > index 423938e..7af1e8c 100644 > > --- a/drivers/char/tpm/tpm-interface.c > > +++ b/drivers/char/tpm/tpm-interface.c > > @@ -480,31 +480,34 @@ static const struct tpm_input_header tpm_getcap_header = { > > Is tpm_getcap_header still needed ? Definitely not, thanks. Are you able to try this out so I could move forward with pull request? /Jarkko