linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Stefan Berger <stefanb@linux.ibm.com>
Cc: linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 5/5] tpm: ppi: Enable submission of optional command parameter for PPI 1.3
Date: Tue, 22 Jan 2019 14:10:31 +0200	[thread overview]
Message-ID: <20190122121031.GD7514@linux.intel.com> (raw)
In-Reply-To: <20190122120159.GC7514@linux.intel.com>

On Tue, Jan 22, 2019 at 02:01:59PM +0200, Jarkko Sakkinen wrote:
> On Thu, Jan 17, 2019 at 12:41:35PM -0500, Stefan Berger wrote:
> > This patch enables a user to specify the additional optional command
> > parameter by writing it into the request file:
> > 
> >    # echo "23 16" > request
> >    # cat request
> >    23 16
> > 
> > For backwards compatibility:
> > 
> > If only 1 parameter is given then we assume this is the operation request
> > number.
> > 
> >    # echo "5" > request
> >    # cat request
> >    5
> > 
> > Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
> > Tested-by: David Safford <david.safford@ge.com>
> 
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

Oops, sorry, this was meant for 4/5, so please ignore that.

The goto statement in tpm_store_ppi_request() is a bit messy as you
jump between branches. Definitely works, but very unreadable.

To get around it, you could change the branching as

if (strcmp(chip->ppi_version, "1.3") == 0 &&
    sscanf(buf, "%llu %llu", &tmp[0].integer.value,
	   &tmp[1].integer.value) == 2) {
	/* ... */
} else if (strcmp(chip->ppi_version, "1.2") == 0) {
	/* ... */
} else {
	/* ... */
}

/Jarkko

      reply	other threads:[~2019-01-22 12:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 17:41 [PATCH v2 0/5] Extend TPM PPI interface to support revision 1.3 Stefan Berger
2019-01-17 17:41 ` [PATCH v2 1/5] tpm: ppi: pass function revision ID to tpm_eval_dsm() Stefan Berger
2019-01-17 17:41 ` [PATCH v2 2/5] tpm: ppi: rename TPM_PPI_REVISION_ID to TPM_PPI_REVISION_ID_1 Stefan Berger
2019-01-22 12:00   ` Jarkko Sakkinen
2019-01-17 17:41 ` [PATCH v2 3/5] tpm: ppi: Display up to 101 operations as define for version 1.3 Stefan Berger
2019-01-17 17:41 ` [PATCH v2 4/5] tpm: ppi: Possibly show command parameter if TPM PPI 1.3 is used Stefan Berger
2019-01-22 12:01   ` Jarkko Sakkinen
2019-01-17 17:41 ` [PATCH v2 5/5] tpm: ppi: Enable submission of optional command parameter for PPI 1.3 Stefan Berger
2019-01-22 12:01   ` Jarkko Sakkinen
2019-01-22 12:10     ` 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=20190122121031.GD7514@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=stefanb@linux.ibm.com \
    /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 NNTP newsgroup(s).