tpm: fix a sparse error in tpm-sysfs.c
PATCH 1/1 tpm: fix a sparse error in tpm-sysfs.c
drivers/char/tpm/tpm-sysfs.c:161:25: warning: expression using sizeof bool
--- drivers/char/tpm/tpm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm.h +1 -1
@@ -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;
Signature · 6 lines
2.4.3 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Quoted 23 lines · Stefan Berger
drivers/char/tpm/tpm-sysfs.c:161:25: warning: expression using sizeof boolFixes c659af78eb7b ("tpm: Check size of response before accessing data")Signed-off-by Stefan Berger <[email protected]>--- drivers/char/tpm/tpm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/tpm/tpm.h +1
-1@@ -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;Signature · 1 line
2.4.3
A better description would be:
The field owned has wrong sized type. This commit fixes the issue.
?
/Jarkko
Quoted 27 lines · Jarkko Sakkinen
Quoted 23 lines · Stefan Berger
drivers/char/tpm/tpm-sysfs.c:161:25: warning: expression using sizeof boolFixes c659af78eb7b ("tpm: Check size of response before accessing data")Signed-off-by Stefan Berger <[email protected]>--- drivers/char/tpm/tpm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/tpm/tpm.h +1
-1@@ -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;Signature · 1 line
2.4.3A better description would be:
Quoted 6 lines
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
Quoted 31 lines · Jarkko Sakkinen
Quoted 30 lines · Jarkko Sakkinen
Quoted 23 lines · Stefan Berger
drivers/char/tpm/tpm-sysfs.c:161:25: warning: expression using sizeof boolFixes c659af78eb7b ("tpm: Check size of response before accessing data")Signed-off-by Stefan Berger <[email protected]>--- drivers/char/tpm/tpm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/tpm/tpm.h +1
-1@@ -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;Signature · 1 line
2.4.3A better description would be:
The field owned has wrong sized type. This commit fixes the issue.
Quoted 7 lines
Quoted 3 lines
?
/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
Quoted 34 lines · Jarkko Sakkinen
Quoted 33 lines · Jarkko Sakkinen
Quoted 32 lines · Jarkko Sakkinen
Quoted 23 lines · Stefan Berger
drivers/char/tpm/tpm-sysfs.c:161:25: warning: expression using sizeof boolFixes c659af78eb7b ("tpm: Check size of response before accessing data")Signed-off-by Stefan Berger <[email protected]>--- drivers/char/tpm/tpm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/tpm/tpm.h +1
-1@@ -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;Signature · 1 line
2.4.3A better description would be:
The field owned has wrong sized type. This commit fixes the issue.
?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
/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