Skip to contentSkip to conversation

tpm: fix type of a local variable in tpm2_get_cc_attrs_tbl()

PATCH In review Jarkko Sakkinen 2 participants 3 messages Sep 13, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 tpm: fix type of a local variable in tpm2_get_cc_attrs_tbl()

The local variable 'attrs' should have the type __be32 instead of u32.

Fixes 58472f5cd4f6 ("tpm: validate TPM 2.0 commands")
---
 drivers/char/tpm/tpm2-cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm2-cmd.c +2 -2
index 70ee32816c48..f40d20671a78 100644
@@ -980,7 +980,7 @@ static int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip)
 {
 	struct tpm_buf buf;
 	u32 nr_commands;
-	u32 *attrs;
+	__be32 *attrs;
 	u32 cc;
 	int i;
 	int rc;
@@ -1020,7 +1020,7 @@ static int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip)
 
 	chip->nr_commands = nr_commands;
 
-	attrs = (u32 *)&buf.data[TPM_HEADER_SIZE + 9];
+	attrs = (__be32 *)&buf.data[TPM_HEADER_SIZE + 9];
 	for (i = 0; i < nr_commands; i++, attrs++) {
 		chip->cc_attrs_tbl[i] = be32_to_cpup(attrs);
 		cc = chip->cc_attrs_tbl[i] & 0xFFFF;
Signature · 6 lines
2.14.1

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by on v1 1/3
#1 lore raw
Quoted 4 lines · Jarkko Sakkinen

The local variable 'attrs' should have the type __be32 instead of u32.

Fixes 58472f5cd4f6 ("tpm: validate TPM 2.0 commands")

All 3 look good to me:

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 11 lines · Jason Gunthorpe
Quoted 4 lines · Jarkko Sakkinen

The local variable 'attrs' should have the type __be32 instead of u32.

Fixes 58472f5cd4f6 ("tpm: validate TPM 2.0 commands")

All 3 look good to me:

Jason

Thanks!

/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html