aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2017-09-13 09:58:49 -0700
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2017-10-18 18:28:48 +0300
commit171360d7800c19622dbdaf202ed6f48ff24a5ae2 (patch)
treefd40e87f3a4454fc954392de7ba32b03ddccd29c /drivers/char
parenttpm-dev-common: Reject too short writes (diff)
downloadlinux-dev-171360d7800c19622dbdaf202ed6f48ff24a5ae2.tar.xz
linux-dev-171360d7800c19622dbdaf202ed6f48ff24a5ae2.zip
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") Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm2-cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
index 70ee32816c48..f40d20671a78 100644
--- a/drivers/char/tpm/tpm2-cmd.c
+++ b/drivers/char/tpm/tpm2-cmd.c
@@ -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;