* [PATCH] tpm: fix a sparse error in tpm-sysfs.c
@ 2017-01-31 18:43 Stefan Berger
2017-01-31 20:37 ` Jarkko Sakkinen
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Berger @ 2017-01-31 18:43 UTC (permalink / raw)
To: tpmdd-devel
Cc: linux-security-module, jarkko.sakkinen, linux-kernel, Stefan Berger
drivers/char/tpm/tpm-sysfs.c:161:25: warning: expression using sizeof bool
Fixes: c659af78eb7b ("tpm: Check size of response before accessing data")
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
drivers/char/tpm/tpm.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index bff37be..6b4e7aa 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -281,7 +281,7 @@ struct permanent_flags_t {
typedef union {
struct permanent_flags_t perm_flags;
struct stclear_flags_t stclear_flags;
- bool owned;
+ __u8 owned;
__be32 num_pcrs;
struct tpm_version_t tpm_version;
struct tpm_version_1_2_t tpm_version_1_2;
--
2.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] tpm: fix a sparse error in tpm-sysfs.c
2017-01-31 18:43 [PATCH] tpm: fix a sparse error in tpm-sysfs.c Stefan Berger
@ 2017-01-31 20:37 ` Jarkko Sakkinen
2017-02-01 8:08 ` [tpmdd-devel] " Jarkko Sakkinen
0 siblings, 1 reply; 5+ messages in thread
From: Jarkko Sakkinen @ 2017-01-31 20:37 UTC (permalink / raw)
To: Stefan Berger; +Cc: tpmdd-devel, linux-security-module, linux-kernel
On Tue, Jan 31, 2017 at 01:43:59PM -0500, Stefan Berger wrote:
> drivers/char/tpm/tpm-sysfs.c:161:25: warning: expression using sizeof bool
>
> Fixes: c659af78eb7b ("tpm: Check size of response before accessing data")
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> ---
> drivers/char/tpm/tpm.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
> index bff37be..6b4e7aa 100644
> --- a/drivers/char/tpm/tpm.h
> +++ b/drivers/char/tpm/tpm.h
> @@ -281,7 +281,7 @@ struct permanent_flags_t {
> typedef union {
> struct permanent_flags_t perm_flags;
> struct stclear_flags_t stclear_flags;
> - bool owned;
> + __u8 owned;
> __be32 num_pcrs;
> struct tpm_version_t tpm_version;
> struct tpm_version_1_2_t tpm_version_1_2;
> --
> 2.4.3
A better description would be:
The field owned has wrong sized type. This commit fixes the
issue.
?
/Jarkko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [tpmdd-devel] [PATCH] tpm: fix a sparse error in tpm-sysfs.c
2017-01-31 20:37 ` Jarkko Sakkinen
@ 2017-02-01 8:08 ` Jarkko Sakkinen
2017-02-01 11:17 ` Jarkko Sakkinen
0 siblings, 1 reply; 5+ messages in thread
From: Jarkko Sakkinen @ 2017-02-01 8:08 UTC (permalink / raw)
To: Stefan Berger; +Cc: linux-security-module, tpmdd-devel, linux-kernel
On Tue, Jan 31, 2017 at 10:37:14PM +0200, Jarkko Sakkinen wrote:
> On Tue, Jan 31, 2017 at 01:43:59PM -0500, Stefan Berger wrote:
> > drivers/char/tpm/tpm-sysfs.c:161:25: warning: expression using sizeof bool
> >
> > Fixes: c659af78eb7b ("tpm: Check size of response before accessing data")
> > Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> > ---
> > drivers/char/tpm/tpm.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
> > index bff37be..6b4e7aa 100644
> > --- a/drivers/char/tpm/tpm.h
> > +++ b/drivers/char/tpm/tpm.h
> > @@ -281,7 +281,7 @@ struct permanent_flags_t {
> > typedef union {
> > struct permanent_flags_t perm_flags;
> > struct stclear_flags_t stclear_flags;
> > - bool owned;
> > + __u8 owned;
> > __be32 num_pcrs;
> > struct tpm_version_t tpm_version;
> > struct tpm_version_1_2_t tpm_version_1_2;
> > --
> > 2.4.3
>
> A better description would be:
>
> The field owned has wrong sized type. This commit fixes the
> issue.
>
> ?
>
> /Jarkko
And doesn't owned print invalid results on a big endian system
i.e. 0x1000000? The commit message needs to be rewritten to capture
the problem.
/Jarkko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [tpmdd-devel] [PATCH] tpm: fix a sparse error in tpm-sysfs.c
2017-02-01 8:08 ` [tpmdd-devel] " Jarkko Sakkinen
@ 2017-02-01 11:17 ` Jarkko Sakkinen
2017-02-01 12:00 ` Jarkko Sakkinen
0 siblings, 1 reply; 5+ messages in thread
From: Jarkko Sakkinen @ 2017-02-01 11:17 UTC (permalink / raw)
To: Stefan Berger; +Cc: linux-security-module, tpmdd-devel, linux-kernel
On Wed, Feb 01, 2017 at 10:08:39AM +0200, Jarkko Sakkinen wrote:
> On Tue, Jan 31, 2017 at 10:37:14PM +0200, Jarkko Sakkinen wrote:
> > On Tue, Jan 31, 2017 at 01:43:59PM -0500, Stefan Berger wrote:
> > > drivers/char/tpm/tpm-sysfs.c:161:25: warning: expression using sizeof bool
> > >
> > > Fixes: c659af78eb7b ("tpm: Check size of response before accessing data")
> > > Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> > > ---
> > > drivers/char/tpm/tpm.h | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
> > > index bff37be..6b4e7aa 100644
> > > --- a/drivers/char/tpm/tpm.h
> > > +++ b/drivers/char/tpm/tpm.h
> > > @@ -281,7 +281,7 @@ struct permanent_flags_t {
> > > typedef union {
> > > struct permanent_flags_t perm_flags;
> > > struct stclear_flags_t stclear_flags;
> > > - bool owned;
> > > + __u8 owned;
> > > __be32 num_pcrs;
> > > struct tpm_version_t tpm_version;
> > > struct tpm_version_1_2_t tpm_version_1_2;
> > > --
> > > 2.4.3
> >
> > A better description would be:
> >
> > The field owned has wrong sized type. This commit fixes the
> > issue.
> >
> > ?
> >
> > /Jarkko
>
> And doesn't owned print invalid results on a big endian system
> i.e. 0x1000000? The commit message needs to be rewritten to capture
> the problem.
Please ignore this, the conversion is done in tpm_getcap(). I'll
update the commit message.
/Jarkko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [tpmdd-devel] [PATCH] tpm: fix a sparse error in tpm-sysfs.c
2017-02-01 11:17 ` Jarkko Sakkinen
@ 2017-02-01 12:00 ` Jarkko Sakkinen
0 siblings, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2017-02-01 12:00 UTC (permalink / raw)
To: Stefan Berger; +Cc: linux-security-module, tpmdd-devel, linux-kernel
On Wed, Feb 01, 2017 at 01:17:34PM +0200, Jarkko Sakkinen wrote:
> On Wed, Feb 01, 2017 at 10:08:39AM +0200, Jarkko Sakkinen wrote:
> > On Tue, Jan 31, 2017 at 10:37:14PM +0200, Jarkko Sakkinen wrote:
> > > On Tue, Jan 31, 2017 at 01:43:59PM -0500, Stefan Berger wrote:
> > > > drivers/char/tpm/tpm-sysfs.c:161:25: warning: expression using sizeof bool
> > > >
> > > > Fixes: c659af78eb7b ("tpm: Check size of response before accessing data")
> > > > Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> > > > ---
> > > > drivers/char/tpm/tpm.h | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
> > > > index bff37be..6b4e7aa 100644
> > > > --- a/drivers/char/tpm/tpm.h
> > > > +++ b/drivers/char/tpm/tpm.h
> > > > @@ -281,7 +281,7 @@ struct permanent_flags_t {
> > > > typedef union {
> > > > struct permanent_flags_t perm_flags;
> > > > struct stclear_flags_t stclear_flags;
> > > > - bool owned;
> > > > + __u8 owned;
> > > > __be32 num_pcrs;
> > > > struct tpm_version_t tpm_version;
> > > > struct tpm_version_1_2_t tpm_version_1_2;
> > > > --
> > > > 2.4.3
> > >
> > > A better description would be:
> > >
> > > The field owned has wrong sized type. This commit fixes the
> > > issue.
> > >
> > > ?
> > >
> > > /Jarkko
> >
> > And doesn't owned print invalid results on a big endian system
> > i.e. 0x1000000? The commit message needs to be rewritten to capture
> > the problem.
>
> Please ignore this, the conversion is done in tpm_getcap(). I'll
> update the commit message.
Now I'm really tripping :( tpm_getcap() does not do any sort of
conversion. _Bool in gcc is one byte. Sorry about this. This is
purely a type error. The size is correct.
/Jarkko
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-02-01 12:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-31 18:43 [PATCH] tpm: fix a sparse error in tpm-sysfs.c Stefan Berger
2017-01-31 20:37 ` Jarkko Sakkinen
2017-02-01 8:08 ` [tpmdd-devel] " Jarkko Sakkinen
2017-02-01 11:17 ` Jarkko Sakkinen
2017-02-01 12:00 ` Jarkko Sakkinen
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).