TPM: MAINTAINERS contacts update and error report fix
Hi James,
The following changes since commit 08162e6a23d476544adfe1164afe9ea8b34ab859:
Yama: remove an unused variable (2012-04-23 17:20:22 +1000)
are available in the git repository at:
git://github.com/srajiv/tpm.git for-james
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.
Marcel Selhorst (1):
MAINTAINERS: TPM maintainers' contacts update
Rajiv Andrade (1):
TPM: chip disabled state erronously being reported as error
MAINTAINERS | 4 ++-- drivers/char/tpm/tpm.c | 13 +++++++++++-- drivers/char/tpm/tpm_infineon.c | 6 +++--- 3 files changed, 16 insertions(+), 7 deletions(-)
MAINTAINERS +2 -2
@@ -6746,10 +6746,10 @@ F: include/linux/shmem_fs.h F: mm/shmem.c TPM DEVICE DRIVER -M: Debora Velarde <[email protected]> M: Rajiv Andrade <[email protected]> W: http://tpmdd.sourceforge.net -M: Marcel Selhorst <[email protected]> +M: Marcel Selhorst <[email protected]> +M: Sirrix AG <[email protected]> W: http://www.sirrix.com L: [email protected] (moderated for non-subscribers) S: Maintained
drivers/char/tpm/tpm.c +11 -2
@@ -827,10 +827,10 @@ EXPORT_SYMBOL_GPL(tpm_pcr_extend);int tpm_do_selftest (struct tpm_chip *chip) {int rc; -u8 digest[TPM_DIGEST_SIZE ];unsigned int loops;unsigned int delay_msec =1000 ;unsigned long duration; +struct tpm_cmd_t cmd; duration =tpm_calc_ordinal_duration (chip,TPM_ORD_CONTINUE_SELFTEST );
@@ -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); + if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) { dev_info(chip->dev, "TPM is disabled/deactivated (0x%X)\n", rc);
drivers/char/tpm/tpm_infineon.c +3 -3
@@ -4,8 +4,8 @@* SLD 9630 TT 1.1 and SLB 9635 TT 1.2 Trusted Platform Module * Specifications at www.trustedcomputinggroup.org * -* Copyright (C) 2005, Marcel Selhorst <[email protected]> -* Sirrix AG - security technologies, http://www.sirrix.com and +* Copyright (C) 2005, Marcel Selhorst <[email protected]> +* Sirrix AG - security technologies <[email protected]> and * Applied Data Security Group, Ruhr-University Bochum, Germany * Project-Homepage: http://www.trust.rub.de/projects/linux-device-driver-infineon-tpm/ *
@@ -671,7 +671,7 @@ static void __exit cleanup_inf(void)module_init (init_inf);module_exit (cleanup_inf); -MODULE_AUTHOR ("Marcel Selhorst <[email protected]>" ); +MODULE_AUTHOR ("Marcel Selhorst <[email protected]>" );MODULE_DESCRIPTION ("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2" );MODULE_VERSION ("1.9.2" );MODULE_LICENSE ("GPL" );
Quoted 3 lines · Rajiv Andrade
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:
drivers/char/tpm/tpm.c
Quoted 1 line
drivers/char/tpm/tpm.c +0
-0
[]
Quoted 4 lines
drivers/char/tpm/tpm.c +0
-0@@ -845,7 +845,16 @@ int tpm_do_selftest(struct tpm_chip *chip)return rc; do {
drivers/char/tpm/tpm.c int tpm_do_selftest(struct tpm_chip *chip) · line 856
Quoted 10 lines
drivers/char/tpm/tpm.c +9
-1- 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.
drivers/char/tpm/tpm.c int tpm_do_selftest(struct tpm_chip *chip) · line 860
Quoted 4 lines
drivers/char/tpm/tpm.c +1
-0+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...Quoted 11 lines · Joe Perches
Quoted 3 lines · Rajiv Andrade
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:
drivers/char/tpm/tpm.c
Quoted 1 line
drivers/char/tpm/tpm.c +0
-0[]
Quoted 3 lines
drivers/char/tpm/tpm.c +0
-0@@ -845,7 +845,16 @@ int tpm_do_selftest(struct tpm_chip *chip)return rc;
Quoted 13 lines
drivers/char/tpm/tpm.c int tpm_do_selftest(struct tpm_chip *chip) · line 856
Quoted 11 lines
drivers/char/tpm/tpm.c +9
-1do { - 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.
Quoted 7 lines
drivers/char/tpm/tpm.c int tpm_do_selftest(struct tpm_chip *chip) · line 860
Quoted 5 lines
drivers/char/tpm/tpm.c +1
-0+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:
Quoted 9 lines
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