Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+2 -2
+2 -2
drivers/char/tpm/tpm2-cmd.c
··· 980 980 { 981 981 struct tpm_buf buf; 982 982 u32 nr_commands; 983 - u32 *attrs; 983 + __be32 *attrs; 984 984 u32 cc; 985 985 int i; 986 986 int rc; ··· 1020 1020 1021 1021 chip->nr_commands = nr_commands; 1022 1022 1023 - attrs = (u32 *)&buf.data[TPM_HEADER_SIZE + 9]; 1023 + attrs = (__be32 *)&buf.data[TPM_HEADER_SIZE + 9]; 1024 1024 for (i = 0; i < nr_commands; i++, attrs++) { 1025 1025 chip->cc_attrs_tbl[i] = be32_to_cpup(attrs); 1026 1026 cc = chip->cc_attrs_tbl[i] & 0xFFFF;