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

login
register
mail settings
Submitter Jarkko Sakkinen
Date Sept. 13, 2017, 5:26 p.m.
Message ID <20170913172620.24829-1-jarkko.sakkinen@linux.intel.com>
Download mbox | patch
Permalink /patch/337665/
State New
Headers show

Comments

Jarkko Sakkinen - Sept. 13, 2017, 5:26 p.m.
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(-)
Jason Gunthorpe - Sept. 13, 2017, 6:14 p.m.
On Wed, Sep 13, 2017 at 10:26:20AM -0700, Jarkko Sakkinen wrote:
> 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>

All 3 look good to me:

Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

Jason

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Jarkko Sakkinen - Sept. 13, 2017, 11:04 p.m.
On Wed, Sep 13, 2017 at 12:14:21PM -0600, Jason Gunthorpe wrote:
> On Wed, Sep 13, 2017 at 10:26:20AM -0700, Jarkko Sakkinen wrote:
> > 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>
> 
> All 3 look good to me:
> 
> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> 
> Jason

Thanks!

/Jarkko

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

Patch

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;