* [PATCH] tpm: use test_bit() to check TPM2 flag in eventlog and sysfs code
@ 2016-11-21 8:03 Nayna Jain
2016-11-21 19:55 ` Jarkko Sakkinen
0 siblings, 1 reply; 7+ messages in thread
From: Nayna Jain @ 2016-11-21 8:03 UTC (permalink / raw)
To: tpmdd-devel
Cc: peterhuewe, tpmdd, jarkko.sakkinen, jgunthorpe,
linux-security-module, Nayna Jain
There is change done to introduce atomic bitops to set and test
chip->flags.
This patch fixes tpm_bios_log_setup() and tpm_sysfs_add_device()
to use test_bit() to check for TPM_CHIP_FLAG_TPM2 flag.
Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
---
drivers/char/tpm/tpm-sysfs.c | 2 +-
drivers/char/tpm/tpm_eventlog.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c
index 82298e51..9a37c26 100644
--- a/drivers/char/tpm/tpm-sysfs.c
+++ b/drivers/char/tpm/tpm-sysfs.c
@@ -284,7 +284,7 @@ static const struct attribute_group tpm_dev_group = {
void tpm_sysfs_add_device(struct tpm_chip *chip)
{
- if (chip->flags & TPM_CHIP_FLAG_TPM2)
+ if (test_bit(TPM_CHIP_FLAG_TPM2, &chip->flags))
return;
/* The sysfs routines rely on an implicit tpm_try_get_ops, device_del
diff --git a/drivers/char/tpm/tpm_eventlog.c b/drivers/char/tpm/tpm_eventlog.c
index ebec4ac..dede2ec 100644
--- a/drivers/char/tpm/tpm_eventlog.c
+++ b/drivers/char/tpm/tpm_eventlog.c
@@ -391,7 +391,7 @@ int tpm_bios_log_setup(struct tpm_chip *chip)
unsigned int cnt;
int rc = 0;
- if (chip->flags & TPM_CHIP_FLAG_TPM2)
+ if (test_bit(TPM_CHIP_FLAG_TPM2, &chip->flags))
return 0;
rc = tpm_read_log(chip);
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] tpm: use test_bit() to check TPM2 flag in eventlog and sysfs code
2016-11-21 8:03 [PATCH] tpm: use test_bit() to check TPM2 flag in eventlog and sysfs code Nayna Jain
@ 2016-11-21 19:55 ` Jarkko Sakkinen
2016-11-22 9:02 ` Nayna
0 siblings, 1 reply; 7+ messages in thread
From: Jarkko Sakkinen @ 2016-11-21 19:55 UTC (permalink / raw)
To: Nayna Jain
Cc: tpmdd-devel, peterhuewe, tpmdd, jgunthorpe, linux-security-module
On Mon, Nov 21, 2016 at 03:03:51AM -0500, Nayna Jain wrote:
> There is change done to introduce atomic bitops to set and test
> chip->flags.
> This patch fixes tpm_bios_log_setup() and tpm_sysfs_add_device()
> to use test_bit() to check for TPM_CHIP_FLAG_TPM2 flag.
>
> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
I'm bit lost of the purpose of this patch.
/Jarkko
> ---
> drivers/char/tpm/tpm-sysfs.c | 2 +-
> drivers/char/tpm/tpm_eventlog.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c
> index 82298e51..9a37c26 100644
> --- a/drivers/char/tpm/tpm-sysfs.c
> +++ b/drivers/char/tpm/tpm-sysfs.c
> @@ -284,7 +284,7 @@ static const struct attribute_group tpm_dev_group = {
>
> void tpm_sysfs_add_device(struct tpm_chip *chip)
> {
> - if (chip->flags & TPM_CHIP_FLAG_TPM2)
> + if (test_bit(TPM_CHIP_FLAG_TPM2, &chip->flags))
> return;
>
> /* The sysfs routines rely on an implicit tpm_try_get_ops, device_del
> diff --git a/drivers/char/tpm/tpm_eventlog.c b/drivers/char/tpm/tpm_eventlog.c
> index ebec4ac..dede2ec 100644
> --- a/drivers/char/tpm/tpm_eventlog.c
> +++ b/drivers/char/tpm/tpm_eventlog.c
> @@ -391,7 +391,7 @@ int tpm_bios_log_setup(struct tpm_chip *chip)
> unsigned int cnt;
> int rc = 0;
>
> - if (chip->flags & TPM_CHIP_FLAG_TPM2)
> + if (test_bit(TPM_CHIP_FLAG_TPM2, &chip->flags))
> return 0;
>
> rc = tpm_read_log(chip);
> --
> 2.5.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] tpm: use test_bit() to check TPM2 flag in eventlog and sysfs code
2016-11-21 19:55 ` Jarkko Sakkinen
@ 2016-11-22 9:02 ` Nayna
[not found] ` <58340988.9000700-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Nayna @ 2016-11-22 9:02 UTC (permalink / raw)
To: Jarkko Sakkinen
Cc: tpmdd-devel, peterhuewe, tpmdd, jgunthorpe, linux-security-module
On 11/22/2016 01:25 AM, Jarkko Sakkinen wrote:
> On Mon, Nov 21, 2016 at 03:03:51AM -0500, Nayna Jain wrote:
>> There is change done to introduce atomic bitops to set and test
>> chip->flags.
>> This patch fixes tpm_bios_log_setup() and tpm_sysfs_add_device()
>> to use test_bit() to check for TPM_CHIP_FLAG_TPM2 flag.
>>
>> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
>
> I'm bit lost of the purpose of this patch.
I was using tabrm branch which has changes related to using bitops for
chip->flags, but it was failing for TPM2 check in tpm_bios_log_setup()
with the existing way of checking. Replacing existing one with
test_bit() check makes it work. Same in case of tpm_sysfs_add_device().
Thanks & Regards,
- Nayna
>
> /Jarkko
>
>> ---
>> drivers/char/tpm/tpm-sysfs.c | 2 +-
>> drivers/char/tpm/tpm_eventlog.c | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c
>> index 82298e51..9a37c26 100644
>> --- a/drivers/char/tpm/tpm-sysfs.c
>> +++ b/drivers/char/tpm/tpm-sysfs.c
>> @@ -284,7 +284,7 @@ static const struct attribute_group tpm_dev_group = {
>>
>> void tpm_sysfs_add_device(struct tpm_chip *chip)
>> {
>> - if (chip->flags & TPM_CHIP_FLAG_TPM2)
>> + if (test_bit(TPM_CHIP_FLAG_TPM2, &chip->flags))
>> return;
>>
>> /* The sysfs routines rely on an implicit tpm_try_get_ops, device_del
>> diff --git a/drivers/char/tpm/tpm_eventlog.c b/drivers/char/tpm/tpm_eventlog.c
>> index ebec4ac..dede2ec 100644
>> --- a/drivers/char/tpm/tpm_eventlog.c
>> +++ b/drivers/char/tpm/tpm_eventlog.c
>> @@ -391,7 +391,7 @@ int tpm_bios_log_setup(struct tpm_chip *chip)
>> unsigned int cnt;
>> int rc = 0;
>>
>> - if (chip->flags & TPM_CHIP_FLAG_TPM2)
>> + if (test_bit(TPM_CHIP_FLAG_TPM2, &chip->flags))
>> return 0;
>>
>> rc = tpm_read_log(chip);
>> --
>> 2.5.0
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] tpm: use test_bit() to check TPM2 flag in eventlog and sysfs code
[not found] ` <58340988.9000700-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
@ 2016-11-22 10:59 ` Jarkko Sakkinen
2016-11-22 11:06 ` Nayna
2016-11-22 11:28 ` Jarkko Sakkinen
0 siblings, 2 replies; 7+ messages in thread
From: Jarkko Sakkinen @ 2016-11-22 10:59 UTC (permalink / raw)
To: Nayna
Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
linux-security-module-u79uwXL29TY76Z2rM5mHXA
On Tue, Nov 22, 2016 at 02:32:00PM +0530, Nayna wrote:
>
>
> On 11/22/2016 01:25 AM, Jarkko Sakkinen wrote:
> > On Mon, Nov 21, 2016 at 03:03:51AM -0500, Nayna Jain wrote:
> > > There is change done to introduce atomic bitops to set and test
> > > chip->flags.
> > > This patch fixes tpm_bios_log_setup() and tpm_sysfs_add_device()
> > > to use test_bit() to check for TPM_CHIP_FLAG_TPM2 flag.
> > >
> > > Signed-off-by: Nayna Jain <nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> >
> > I'm bit lost of the purpose of this patch.
>
> I was using tabrm branch which has changes related to using bitops for
> chip->flags, but it was failing for TPM2 check in tpm_bios_log_setup() with
> the existing way of checking. Replacing existing one with test_bit() check
> makes it work. Same in case of tpm_sysfs_add_device().
Why didn't you just response to the thread with a review comment
especially as the patch is not applied to the master branch?
/Jarkko
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] tpm: use test_bit() to check TPM2 flag in eventlog and sysfs code
2016-11-22 10:59 ` Jarkko Sakkinen
@ 2016-11-22 11:06 ` Nayna
[not found] ` <583426D0.40105-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-11-22 11:28 ` Jarkko Sakkinen
1 sibling, 1 reply; 7+ messages in thread
From: Nayna @ 2016-11-22 11:06 UTC (permalink / raw)
To: Jarkko Sakkinen
Cc: tpmdd-devel, peterhuewe, tpmdd, jgunthorpe, linux-security-module
On 11/22/2016 04:29 PM, Jarkko Sakkinen wrote:
> On Tue, Nov 22, 2016 at 02:32:00PM +0530, Nayna wrote:
>>
>>
>> On 11/22/2016 01:25 AM, Jarkko Sakkinen wrote:
>>> On Mon, Nov 21, 2016 at 03:03:51AM -0500, Nayna Jain wrote:
>>>> There is change done to introduce atomic bitops to set and test
>>>> chip->flags.
>>>> This patch fixes tpm_bios_log_setup() and tpm_sysfs_add_device()
>>>> to use test_bit() to check for TPM_CHIP_FLAG_TPM2 flag.
>>>>
>>>> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
>>>
>>> I'm bit lost of the purpose of this patch.
>>
>> I was using tabrm branch which has changes related to using bitops for
>> chip->flags, but it was failing for TPM2 check in tpm_bios_log_setup() with
>> the existing way of checking. Replacing existing one with test_bit() check
>> makes it work. Same in case of tpm_sysfs_add_device().
>
> Why didn't you just response to the thread with a review comment
> especially as the patch is not applied to the master branch?
Oh!! Ok.. Sorry, I should have done that.
Will take care next time.
So basically it needs to be fixed as part of that patch.
Thanks & Regards,
- Nayna
>
> /Jarkko
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] tpm: use test_bit() to check TPM2 flag in eventlog and sysfs code
2016-11-22 10:59 ` Jarkko Sakkinen
2016-11-22 11:06 ` Nayna
@ 2016-11-22 11:28 ` Jarkko Sakkinen
1 sibling, 0 replies; 7+ messages in thread
From: Jarkko Sakkinen @ 2016-11-22 11:28 UTC (permalink / raw)
To: Nayna; +Cc: tpmdd-devel, peterhuewe, tpmdd, jgunthorpe, linux-security-module
On Tue, Nov 22, 2016 at 12:59:59PM +0200, Jarkko Sakkinen wrote:
> On Tue, Nov 22, 2016 at 02:32:00PM +0530, Nayna wrote:
> >
> >
> > On 11/22/2016 01:25 AM, Jarkko Sakkinen wrote:
> > > On Mon, Nov 21, 2016 at 03:03:51AM -0500, Nayna Jain wrote:
> > > > There is change done to introduce atomic bitops to set and test
> > > > chip->flags.
> > > > This patch fixes tpm_bios_log_setup() and tpm_sysfs_add_device()
> > > > to use test_bit() to check for TPM_CHIP_FLAG_TPM2 flag.
> > > >
> > > > Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
> > >
> > > I'm bit lost of the purpose of this patch.
> >
> > I was using tabrm branch which has changes related to using bitops for
> > chip->flags, but it was failing for TPM2 check in tpm_bios_log_setup() with
> > the existing way of checking. Replacing existing one with test_bit() check
> > makes it work. Same in case of tpm_sysfs_add_device().
>
> Why didn't you just response to the thread with a review comment
> especially as the patch is not applied to the master branch?
Anyway I updated the corresponding patches. Thanks for reporting these
issues!
/Jarkko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] tpm: use test_bit() to check TPM2 flag in eventlog and sysfs code
[not found] ` <583426D0.40105-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
@ 2016-11-22 14:31 ` Jarkko Sakkinen
0 siblings, 0 replies; 7+ messages in thread
From: Jarkko Sakkinen @ 2016-11-22 14:31 UTC (permalink / raw)
To: Nayna
Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
linux-security-module-u79uwXL29TY76Z2rM5mHXA
On Tue, Nov 22, 2016 at 04:36:56PM +0530, Nayna wrote:
>
>
> On 11/22/2016 04:29 PM, Jarkko Sakkinen wrote:
> > On Tue, Nov 22, 2016 at 02:32:00PM +0530, Nayna wrote:
> > >
> > >
> > > On 11/22/2016 01:25 AM, Jarkko Sakkinen wrote:
> > > > On Mon, Nov 21, 2016 at 03:03:51AM -0500, Nayna Jain wrote:
> > > > > There is change done to introduce atomic bitops to set and test
> > > > > chip->flags.
> > > > > This patch fixes tpm_bios_log_setup() and tpm_sysfs_add_device()
> > > > > to use test_bit() to check for TPM_CHIP_FLAG_TPM2 flag.
> > > > >
> > > > > Signed-off-by: Nayna Jain <nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> > > >
> > > > I'm bit lost of the purpose of this patch.
> > >
> > > I was using tabrm branch which has changes related to using bitops for
> > > chip->flags, but it was failing for TPM2 check in tpm_bios_log_setup() with
> > > the existing way of checking. Replacing existing one with test_bit() check
> > > makes it work. Same in case of tpm_sysfs_add_device().
> >
> > Why didn't you just response to the thread with a review comment
> > especially as the patch is not applied to the master branch?
>
> Oh!! Ok.. Sorry, I should have done that.
> Will take care next time.
>
> So basically it needs to be fixed as part of that patch.
NP. Thanks for reporting the issue!
/Jarkko
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-11-22 14:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-21 8:03 [PATCH] tpm: use test_bit() to check TPM2 flag in eventlog and sysfs code Nayna Jain
2016-11-21 19:55 ` Jarkko Sakkinen
2016-11-22 9:02 ` Nayna
[not found] ` <58340988.9000700-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-11-22 10:59 ` Jarkko Sakkinen
2016-11-22 11:06 ` Nayna
[not found] ` <583426D0.40105-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-11-22 14:31 ` Jarkko Sakkinen
2016-11-22 11:28 ` Jarkko Sakkinen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.