From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751555AbdBCSrE (ORCPT ); Fri, 3 Feb 2017 13:47:04 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47277 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751209AbdBCSrD (ORCPT ); Fri, 3 Feb 2017 13:47:03 -0500 Subject: Re: [tpmdd-devel] [PATCH] tpm: fix type issues in tpm_getcap() To: Jarkko Sakkinen References: <20170201175347.2035-1-jarkko.sakkinen@linux.intel.com> <58947D8E.20000@linux.vnet.ibm.com> <20170203181523.mu4hqhb7epqmthfd@intel.com> Cc: tpmdd-devel@lists.sourceforge.net, open list , linux-security-module@vger.kernel.org From: Nayna Date: Sat, 4 Feb 2017 00:16:31 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20170203181523.mu4hqhb7epqmthfd@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17020318-0016-0000-0000-00000610E312 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006550; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000201; SDB=6.00816765; UDB=6.00398891; IPR=6.00594200; BA=6.00005114; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014170; XFM=3.00000011; UTC=2017-02-03 18:47:00 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17020318-0017-0000-0000-000037171AB7 Message-Id: <5894D007.6060207@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-02-03_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702030177 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/03/2017 11:45 PM, Jarkko Sakkinen wrote: > 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? Yes, I tried it out and see a problem, I already replied that in one other mail. The tag and ordinal are converted to BE twice, once in #define and again in tpm_buf_init. Thanks & Regards, - Nayna > > /Jarkko >