From: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Peter Huewe <peterhuewe-Mmb7MZpHnFY@public.gmane.org>,
Marcel Selhorst <tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org>,
Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Subject: Re: [PATCH] tpm: print tpm error code in hex for TPM2.0 devices
Date: Sat, 29 Apr 2017 14:17:38 +0300 [thread overview]
Message-ID: <20170429111738.vpjm3bxabiaa6y56@intel.com> (raw)
In-Reply-To: <20170428171809.qtyb7naoezf7ern3@rhwork>
On Fri, Apr 28, 2017 at 10:18:09AM -0700, Jerry Snitselaar wrote:
> On Fri Apr 28 17, Jarkko Sakkinen wrote:
> > On Wed, Apr 26, 2017 at 03:39:54PM -0700, Jerry Snitselaar wrote:
> > > For easier decoding, output the error code returned
> > > from the tpm device in hex when the device is TPM2.0.
> > >
> > > Cc: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> > > Cc: Peter Huewe <peterhuewe-Mmb7MZpHnFY@public.gmane.org>
> > > Cc: Marcel Selhorst <tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org>
> > > Cc: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> > > Reported-by: Ken Goldman <kgoldman-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> > > Signed-off-by: Jerry Snitselaar <jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > > ---
> > > drivers/char/tpm/tpm-interface.c | 11 ++++++++---
> > > 1 file changed, 8 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> > > index bd2128e0b56c..b6c67eef9ae7 100644
> > > --- a/drivers/char/tpm/tpm-interface.c
> > > +++ b/drivers/char/tpm/tpm-interface.c
> > > @@ -453,9 +453,14 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, const void *buf,
> > > return -EFAULT;
> > >
> > > err = be32_to_cpu(header->return_code);
> > > - if (err != 0 && desc)
> > > - dev_err(&chip->dev, "A TPM error (%d) occurred %s\n", err,
> > > - desc);
> > > + if (err != 0 && desc) {
> > > + if (chip->flags & TPM_CHIP_FLAG_TPM2)
> > > + dev_err(&chip->dev, "A TPM 2.0 error (0x%x) occurred %s\n",
> > > + err, desc);
> > > + else
> > > + dev_err(&chip->dev, "A TPM error (%d) occurred %s\n",
> > > + err, desc);
> > > + }
> >
> > Is there a reason for not to apply this also to TPM 1.2?
> >
> > /Jarkko
> >
>
> The 2.0 spec lists the response codes in hex, while the 1.2 spec lists them
> in decimal. Maybe something like the following instead?
Ah. Well, I thinkthe original patch is fine then.
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
/Jarkko
>
> index 158c1db83f05..1f433d56f53c 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -526,8 +526,8 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_space *space,
>
> err = be32_to_cpu(header->return_code);
> if (err != 0 && desc)
> - dev_err(&chip->dev, "A TPM error (%d) occurred %s\n", err,
> - desc);
> + dev_err(&chip->dev, "A TPM error (%d (0x%x)) occurred %s\n", err,
> + err, desc);
> if (err)
> return err;
>
>
> > > if (err)
> > > return err;
> > >
> > > --
> > > 2.13.0.rc0.45.ge2cb6ab84
> > >
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
prev parent reply other threads:[~2017-04-29 11:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-26 22:39 [PATCH] tpm: print tpm error code in hex for TPM2.0 devices Jerry Snitselaar
[not found] ` <20170426223954.18365-1-jsnitsel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-04-28 12:01 ` Jarkko Sakkinen
[not found] ` <20170428120149.jjxwbp6nmthk4y3q-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-04-28 17:18 ` Jerry Snitselaar
2017-04-29 11:17 ` Jarkko Sakkinen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170429111738.vpjm3bxabiaa6y56@intel.com \
--to=jarkko.sakkinen-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=peterhuewe-Mmb7MZpHnFY@public.gmane.org \
--cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).