[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160715031701.GA25406@apronin>
Date: Thu, 14 Jul 2016 20:17:01 -0700
From: Andrey Pronin <apronin@...omium.org>
To: Jason Gunthorpe <jgunthorpe@...idianresearch.com>
Cc: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
Peter Huewe <peterhuewe@....de>,
Marcel Selhorst <tpmdd@...horst.net>,
tpmdd-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
groeck@...omium.org, smbarber@...omium.org, dianders@...omium.org
Subject: Re: [PATCH 2/2] tpm: fix byte-order for the value read by
tpm2_get_tpm_pt
On Thu, Jul 14, 2016 at 09:10:46PM -0600, Jason Gunthorpe wrote:
> On Thu, Jul 14, 2016 at 06:07:18PM -0700, Andrey Pronin wrote:
> > Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590
> > Signed-off-by: Andrey Pronin <apronin@...omium.org>
> > drivers/char/tpm/tpm2-cmd.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
> > index a1673dc..a88b31e 100644
> > +++ b/drivers/char/tpm/tpm2-cmd.c
> > @@ -703,7 +703,7 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, u32 *value,
> >
> > rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), desc);
> > if (!rc)
> > - *value = cmd.params.get_tpm_pt_out.value;
> > + *value = be32_to_cpu(cmd.params.get_tpm_pt_out.value);
>
> Huh.
>
> Jarkko: Are you running sparse on the tpm stuff? The annotations look
> right here, sparse should have complained on this? Andrey, did sparse
> complain here or is there something more serious wrong as well??
>
> Reviewed-by: Jason Gunthorpe <jgunthorpe@...idianresearch.com>
>
> Jason
No, this is not sparse complaining. I tried using tpm2_get_tpm_pt() to
read permanent flags and discovered that it was missing byte-ordering
conversion. The only place tpm2_get_tpm_pt() was used before was in
tpm2_gen_interrupt, which discarded the result. So, nobody noticed,
I guess.
Andrey
Powered by blists - more mailing lists