tpm: fix type of a local variable in tpm2_get_cc_attrs_tbl()
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Wed, 13 Sep 2017 16:58:49 +0000 (09:58 -0700)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Wed, 18 Oct 2017 15:28:48 +0000 (18:28 +0300)
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>
drivers/char/tpm/tpm2-cmd.c

index 70ee32816c488d5b80cf39e877a22b030e0e2f5b..f40d20671a78fd8469c87074f18b5e81b5d3536d 100644 (file)
@@ -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;