Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1731739

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

From Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH 1/3] tpm: fix type of a local variable in tpm2_get_cc_attrs_tbl()
Date 2017-09-13 19:30 +0200
Message-ID <upjE5-1RR-15@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/char/tpm/tpm2-cmd.c | 4 ++--
 1 file 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;
-- 
2.14.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] tpm: fix type of a local variable in tpm2_get_cc_attrs_tbl() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-09-13 19:30 +0200
  Re: [PATCH 1/3] tpm: fix type of a local variable in  tpm2_get_cc_attrs_tbl() Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-09-13 20:20 +0200
    Re: [PATCH 1/3] tpm: fix type of a local variable in  tpm2_get_cc_attrs_tbl() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-09-14 01:10 +0200

csiph-web