lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4FA8037C.8010304@linux.vnet.ibm.com>
Date:	Mon, 07 May 2012 14:16:44 -0300
From:	Rajiv Andrade <srajiv@...ux.vnet.ibm.com>
To:	Joe Perches <joe@...ches.com>
CC:	jmorris@...ei.org, pebolle@...cali.nl,
	linux-kernel@...r.kernel.org, tpmdd@...horst.net
Subject: Re: [PULL] TPM: MAINTAINERS contacts update and error report fix

On 03/05/12 17:14, Joe Perches wrote:
> On Thu, 2012-05-03 at 14:10 -0300, Rajiv Andrade wrote:
>> The first as the subject implies is just a contacts update, and the second
>> makes the driver avoid to mistakenly report the disabled and deactivated TPM
>> states as an error.
> trivia:
>
>> diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
> []
>> @@ -845,7 +845,16 @@ int tpm_do_selftest(struct tpm_chip *chip)
>>   		return rc;
>>
>>   	do {
>> -		rc = __tpm_pcr_read(chip, 0, digest);
>> +		/* Attempt to read a PCR value */
>> +		cmd.header.in = pcrread_header;
>> +		cmd.params.pcrread_in.pcr_idx = cpu_to_be32(0);
>> +		rc = tpm_transmit(chip, (u8 *)&cmd, READ_PCR_RESULT_SIZE);
>> +
>> +		if (rc<  TPM_HEADER_SIZE)
>> +			return -EFAULT;
>> +		else
>> +			rc = be32_to_cpu(cmd.header.out.return_code);
> The else shouldn't be used here.
> Indented code followed by an unindented test is not nice.
Yep.. I missed it.
>
>> +
>>   		if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
>>   			dev_info(chip->dev,
>>   				 "TPM is disabled/deactivated (0x%X)\n", rc);
> A more kernel style conformant style looks like:
>
> 		rc = tpm_transmit(chip, (u8 *)&cmd, READ_PCR_RESULT_SIZE);
> 		if (rc<  TPM_HEADER_SIZE)
> 			return -EFAULT;
>
> 		rc = be32_to_cpu(cmd.header.out.return_code);
>   		if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
> 			etc...
>
>
Thanks for pointing.

James, please ignore, I'll send a better version of this fix.

Rajiv

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ