diff mbox series

[2/2] tpm: use loop iterator to set sts data field

Message ID 20181106052144.31841-2-ppandit@redhat.com (mailing list archive)
State New, archived
Headers show
Series [1/2] tpm: check localities index | expand

Commit Message

Prasad Pandit Nov. 6, 2018, 5:21 a.m. UTC
From: Prasad J Pandit <pjp@fedoraproject.org>

When TIS request is done, set 'sts' data field across all localities.

Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
 hw/tpm/tpm_tis.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marc-André Lureau Nov. 6, 2018, 8:13 a.m. UTC | #1
Hi

On Tue, Nov 6, 2018 at 9:24 AM P J P <ppandit@redhat.com> wrote:
>
> From: Prasad J Pandit <pjp@fedoraproject.org>
>
> When TIS request is done, set 'sts' data field across all localities.

The code certainly meant to set the field across all localities.
However I don't see in the "TCG PC Client Specific TPM Interface
Specification (TIS)" where it states that the field should be set
across all localities. Could you quote the relevant part?

thanks

> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
> ---
>  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 20126dd838..58d90645bc 100644
> --- a/hw/tpm/tpm_tis.c
> +++ b/hw/tpm/tpm_tis.c
> @@ -299,7 +299,7 @@ static void tpm_tis_request_completed(TPMIf *ti, int ret)
>
>      if (s->cmd.selftest_done) {
>          for (l = 0; l < TPM_TIS_NUM_LOCALITIES; l++) {
> -            s->loc[locty].sts |= TPM_TIS_STS_SELFTEST_DONE;
> +            s->loc[l].sts |= TPM_TIS_STS_SELFTEST_DONE;
>          }
>      }
>
> --
> 2.17.2
>
>
Stefan Berger Nov. 6, 2018, 2:26 p.m. UTC | #2
On 11/6/18 12:21 AM, P J P wrote:
> From: Prasad J Pandit <pjp@fedoraproject.org>
>
> When TIS request is done, set 'sts' data field across all localities.
>
> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>


Reviewed-by: Stefan Berger <stefanb@linux.ibm.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 20126dd838..58d90645bc 100644
> --- a/hw/tpm/tpm_tis.c
> +++ b/hw/tpm/tpm_tis.c
> @@ -299,7 +299,7 @@ static void tpm_tis_request_completed(TPMIf *ti, int ret)
>
>       if (s->cmd.selftest_done) {
>           for (l = 0; l < TPM_TIS_NUM_LOCALITIES; l++) {
> -            s->loc[locty].sts |= TPM_TIS_STS_SELFTEST_DONE;
> +            s->loc[l].sts |= TPM_TIS_STS_SELFTEST_DONE;
>           }
>       }
>
Stefan Berger Nov. 6, 2018, 2:28 p.m. UTC | #3
On 11/6/18 3:13 AM, Marc-André Lureau wrote:
> Hi
>
> On Tue, Nov 6, 2018 at 9:24 AM P J P <ppandit@redhat.com> wrote:
>> From: Prasad J Pandit <pjp@fedoraproject.org>
>>
>> When TIS request is done, set 'sts' data field across all localities.
> The code certainly meant to set the field across all localities.
> However I don't see in the "TCG PC Client Specific TPM Interface
> Specification (TIS)" where it states that the field should be set
> across all localities. Could you quote the relevant part?

I don't see it explicitly mentioned but would interpret it as being a 
flag across all localities.


     Stefan


>
> thanks
>
>> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
>> ---
>>   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 20126dd838..58d90645bc 100644
>> --- a/hw/tpm/tpm_tis.c
>> +++ b/hw/tpm/tpm_tis.c
>> @@ -299,7 +299,7 @@ static void tpm_tis_request_completed(TPMIf *ti, int ret)
>>
>>       if (s->cmd.selftest_done) {
>>           for (l = 0; l < TPM_TIS_NUM_LOCALITIES; l++) {
>> -            s->loc[locty].sts |= TPM_TIS_STS_SELFTEST_DONE;
>> +            s->loc[l].sts |= TPM_TIS_STS_SELFTEST_DONE;
>>           }
>>       }
>>
>> --
>> 2.17.2
>>
>>
>
diff mbox series

Patch

diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 20126dd838..58d90645bc 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -299,7 +299,7 @@  static void tpm_tis_request_completed(TPMIf *ti, int ret)
 
     if (s->cmd.selftest_done) {
         for (l = 0; l < TPM_TIS_NUM_LOCALITIES; l++) {
-            s->loc[locty].sts |= TPM_TIS_STS_SELFTEST_DONE;
+            s->loc[l].sts |= TPM_TIS_STS_SELFTEST_DONE;
         }
     }