Commit 171360d7 authored by Jarkko Sakkinen's avatar Jarkko Sakkinen

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: 58472f5c ("tpm: validate TPM 2.0 commands")
Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
parent ee70bc1e
...@@ -980,7 +980,7 @@ static int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip) ...@@ -980,7 +980,7 @@ static int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip)
{ {
struct tpm_buf buf; struct tpm_buf buf;
u32 nr_commands; u32 nr_commands;
u32 *attrs; __be32 *attrs;
u32 cc; u32 cc;
int i; int i;
int rc; int rc;
...@@ -1020,7 +1020,7 @@ static int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip) ...@@ -1020,7 +1020,7 @@ static int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip)
chip->nr_commands = nr_commands; 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++) { for (i = 0; i < nr_commands; i++, attrs++) {
chip->cc_attrs_tbl[i] = be32_to_cpup(attrs); chip->cc_attrs_tbl[i] = be32_to_cpup(attrs);
cc = chip->cc_attrs_tbl[i] & 0xFFFF; cc = chip->cc_attrs_tbl[i] & 0xFFFF;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment