diff mbox series

[v2,1/3] tpm_tis: fix loop that cancels any seizure by a lower locality

Message ID 1549897385-10091-1-git-send-email-liam.merwick@oracle.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/3] tpm_tis: fix loop that cancels any seizure by a lower locality | expand

Commit Message

Liam Merwick Feb. 11, 2019, 3:03 p.m. UTC
In tpm_tis_mmio_write() if the requesting locality is seizing
access, any seizure by a lower locality is cancelled.  However the
loop doing the seizure had an off-by-one error and the locality
immediately preceding the requesting locality was not being cleared.
This is fixed by adjusting the test in the for loop to check the
localities up to the requesting locality.

Signed-off-by: Liam Merwick <Liam.Merwick@oracle.com>
---
 hw/tpm/tpm_tis.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefan Berger Feb. 11, 2019, 8:53 p.m. UTC | #1
On 2/11/19 10:03 AM, Liam Merwick wrote:
> In tpm_tis_mmio_write() if the requesting locality is seizing
> access, any seizure by a lower locality is cancelled.  However the
> loop doing the seizure had an off-by-one error and the locality
> immediately preceding the requesting locality was not being cleared.
> This is fixed by adjusting the test in the for loop to check the
> localities up to the requesting locality.
>
> Signed-off-by: Liam Merwick <Liam.Merwick@oracle.com>
> ---
>   hw/tpm/tpm_tis.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
> index fd6bb9b59a96..61a130beef35 100644
> --- a/hw/tpm/tpm_tis.c
> +++ b/hw/tpm/tpm_tis.c
> @@ -624,7 +624,7 @@ static void tpm_tis_mmio_write(void *opaque, hwaddr addr,
>                   }
>   
>                   /* cancel any seize by a lower locality */
> -                for (l = 0; l < locty - 1; l++) {
> +                for (l = 0; l < locty; l++) {
>                       s->loc[l].access &= ~TPM_TIS_ACCESS_SEIZE;
>                   }
>   


Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
diff mbox series

Patch

diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index fd6bb9b59a96..61a130beef35 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -624,7 +624,7 @@  static void tpm_tis_mmio_write(void *opaque, hwaddr addr,
                 }
 
                 /* cancel any seize by a lower locality */
-                for (l = 0; l < locty - 1; l++) {
+                for (l = 0; l < locty; l++) {
                     s->loc[l].access &= ~TPM_TIS_ACCESS_SEIZE;
                 }