qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/3] Cleanup and locality range check
@ 2018-12-04 15:04 Stefan Berger
  2018-12-04 15:04 ` [Qemu-devel] [PATCH v3 1/3] tpm: Remove unused locty parameter from tpm_tis_abort() Stefan Berger
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Stefan Berger @ 2018-12-04 15:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: ppandit, marcandre.lureau, Stefan Berger

This series of patches removes an unnecessary parameter from tpm_tis_abort()
and adds a locality range check to tpm_tis_prep_abort() and
tpm_tis_request_completed().

   Stefan

Stefan Berger (3):
  tpm: Remove unused locty parameter from tpm_tis_abort()
  tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid
  tpm: Make sure the locality received from backend is valid

 hw/tpm/tpm_tis.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH v3 1/3] tpm: Remove unused locty parameter from tpm_tis_abort()
  2018-12-04 15:04 [Qemu-devel] [PATCH v3 0/3] Cleanup and locality range check Stefan Berger
@ 2018-12-04 15:04 ` Stefan Berger
  2018-12-04 15:04 ` [Qemu-devel] [PATCH v3 2/3] tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid Stefan Berger
  2018-12-04 15:04 ` [Qemu-devel] [PATCH v3 3/3] tpm: Make sure the locality received from backend " Stefan Berger
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Berger @ 2018-12-04 15:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: ppandit, marcandre.lureau, Stefan Berger, Stefan Berger

Remove the unused locty parameter from tpm_tis_abort() function.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/tpm/tpm_tis.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index d9322692ee..176d424ed9 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -233,7 +233,7 @@ static void tpm_tis_new_active_locality(TPMState *s, uint8_t new_active_locty)
 }
 
 /* abort -- this function switches the locality */
-static void tpm_tis_abort(TPMState *s, uint8_t locty)
+static void tpm_tis_abort(TPMState *s)
 {
     s->rw_offset = 0;
 
@@ -281,7 +281,7 @@ static void tpm_tis_prep_abort(TPMState *s, uint8_t locty, uint8_t newlocty)
         }
     }
 
-    tpm_tis_abort(s, locty);
+    tpm_tis_abort(s);
 }
 
 /*
@@ -311,7 +311,7 @@ static void tpm_tis_request_completed(TPMIf *ti, int ret)
     }
 
     if (TPM_TIS_IS_VALID_LOCTY(s->next_locty)) {
-        tpm_tis_abort(s, locty);
+        tpm_tis_abort(s);
     }
 
     tpm_tis_raise_irq(s, locty,
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH v3 2/3] tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid
  2018-12-04 15:04 [Qemu-devel] [PATCH v3 0/3] Cleanup and locality range check Stefan Berger
  2018-12-04 15:04 ` [Qemu-devel] [PATCH v3 1/3] tpm: Remove unused locty parameter from tpm_tis_abort() Stefan Berger
@ 2018-12-04 15:04 ` Stefan Berger
  2018-12-04 15:19   ` Marc-André Lureau
  2018-12-04 15:04 ` [Qemu-devel] [PATCH v3 3/3] tpm: Make sure the locality received from backend " Stefan Berger
  2 siblings, 1 reply; 6+ messages in thread
From: Stefan Berger @ 2018-12-04 15:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: ppandit, marcandre.lureau, Stefan Berger, Stefan Berger

Make sure that the new locality passed to tpm_tis_prep_abort()
is valid.

Add a comment to aborting_locty that it may be any locality, including
TPM_TIS_NO_LOCALITY.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 hw/tpm/tpm_tis.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 176d424ed9..04e4ad9212 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -263,7 +263,9 @@ static void tpm_tis_prep_abort(TPMState *s, uint8_t locty, uint8_t newlocty)
 {
     uint8_t busy_locty;
 
-    s->aborting_locty = locty;
+    assert(TPM_TIS_IS_VALID_LOCTY(newlocty));
+
+    s->aborting_locty = locty; /* may also be TPM_TIS_NO_LOCALITY */
     s->next_locty = newlocty;  /* locality after successful abort */
 
     /*
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH v3 3/3] tpm: Make sure the locality received from backend is valid
  2018-12-04 15:04 [Qemu-devel] [PATCH v3 0/3] Cleanup and locality range check Stefan Berger
  2018-12-04 15:04 ` [Qemu-devel] [PATCH v3 1/3] tpm: Remove unused locty parameter from tpm_tis_abort() Stefan Berger
  2018-12-04 15:04 ` [Qemu-devel] [PATCH v3 2/3] tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid Stefan Berger
@ 2018-12-04 15:04 ` Stefan Berger
  2018-12-04 15:20   ` Marc-André Lureau
  2 siblings, 1 reply; 6+ messages in thread
From: Stefan Berger @ 2018-12-04 15:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: ppandit, marcandre.lureau, Stefan Berger, Stefan Berger

Make sure that the locality passed from the backend to
tpm_tis_request_completed() is valid.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 hw/tpm/tpm_tis.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 04e4ad9212..2563d7501f 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -295,6 +295,8 @@ static void tpm_tis_request_completed(TPMIf *ti, int ret)
     uint8_t locty = s->cmd.locty;
     uint8_t l;
 
+    assert(TPM_TIS_IS_VALID_LOCTY(locty));
+
     if (s->cmd.selftest_done) {
         for (l = 0; l < TPM_TIS_NUM_LOCALITIES; l++) {
             s->loc[l].sts |= TPM_TIS_STS_SELFTEST_DONE;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v3 2/3] tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid
  2018-12-04 15:04 ` [Qemu-devel] [PATCH v3 2/3] tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid Stefan Berger
@ 2018-12-04 15:19   ` Marc-André Lureau
  0 siblings, 0 replies; 6+ messages in thread
From: Marc-André Lureau @ 2018-12-04 15:19 UTC (permalink / raw)
  To: Stefan Berger; +Cc: QEMU, P J P, stefanb

On Tue, Dec 4, 2018 at 7:04 PM Stefan Berger <stefanb@linux.vnet.ibm.com> wrote:
>
> Make sure that the new locality passed to tpm_tis_prep_abort()
> is valid.
>
> Add a comment to aborting_locty that it may be any locality, including
> TPM_TIS_NO_LOCALITY.
>
> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  hw/tpm/tpm_tis.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
> index 176d424ed9..04e4ad9212 100644
> --- a/hw/tpm/tpm_tis.c
> +++ b/hw/tpm/tpm_tis.c
> @@ -263,7 +263,9 @@ static void tpm_tis_prep_abort(TPMState *s, uint8_t locty, uint8_t newlocty)
>  {
>      uint8_t busy_locty;
>
> -    s->aborting_locty = locty;
> +    assert(TPM_TIS_IS_VALID_LOCTY(newlocty));
> +
> +    s->aborting_locty = locty; /* may also be TPM_TIS_NO_LOCALITY */
>      s->next_locty = newlocty;  /* locality after successful abort */
>
>      /*
> --
> 2.17.1
>


-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v3 3/3] tpm: Make sure the locality received from backend is valid
  2018-12-04 15:04 ` [Qemu-devel] [PATCH v3 3/3] tpm: Make sure the locality received from backend " Stefan Berger
@ 2018-12-04 15:20   ` Marc-André Lureau
  0 siblings, 0 replies; 6+ messages in thread
From: Marc-André Lureau @ 2018-12-04 15:20 UTC (permalink / raw)
  To: Stefan Berger; +Cc: QEMU, P J P, stefanb

On Tue, Dec 4, 2018 at 7:04 PM Stefan Berger <stefanb@linux.vnet.ibm.com> wrote:
>
> Make sure that the locality passed from the backend to
> tpm_tis_request_completed() is valid.
>
> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  hw/tpm/tpm_tis.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
> index 04e4ad9212..2563d7501f 100644
> --- a/hw/tpm/tpm_tis.c
> +++ b/hw/tpm/tpm_tis.c
> @@ -295,6 +295,8 @@ static void tpm_tis_request_completed(TPMIf *ti, int ret)
>      uint8_t locty = s->cmd.locty;
>      uint8_t l;
>
> +    assert(TPM_TIS_IS_VALID_LOCTY(locty));
> +
>      if (s->cmd.selftest_done) {
>          for (l = 0; l < TPM_TIS_NUM_LOCALITIES; l++) {
>              s->loc[l].sts |= TPM_TIS_STS_SELFTEST_DONE;
> --
> 2.17.1
>


-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-04 15:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-04 15:04 [Qemu-devel] [PATCH v3 0/3] Cleanup and locality range check Stefan Berger
2018-12-04 15:04 ` [Qemu-devel] [PATCH v3 1/3] tpm: Remove unused locty parameter from tpm_tis_abort() Stefan Berger
2018-12-04 15:04 ` [Qemu-devel] [PATCH v3 2/3] tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid Stefan Berger
2018-12-04 15:19   ` Marc-André Lureau
2018-12-04 15:04 ` [Qemu-devel] [PATCH v3 3/3] tpm: Make sure the locality received from backend " Stefan Berger
2018-12-04 15:20   ` Marc-André Lureau

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).