Skip to contentSkip to conversation

tpm: Add explicit endianness cast

PATCH In review Thiebaud Weksteen 2 participants 4 messages Apr 25, 2018 – May 3, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/4 tpm: Add explicit endianness cast

---
 drivers/char/tpm/tpm_eventlog_of.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_eventlog_of.c +2 -2
index 96fd5646f866..ea0f16f19d73 100644
@@ -56,8 +56,8 @@ int tpm_read_log_of(struct tpm_chip *chip)
 	 * but physical tpm needs the conversion.
 	 */
 	if (of_property_match_string(np, "compatible", "IBM,vtpm") < 0) {
-		size = be32_to_cpup(sizep);
-		base = be64_to_cpup(basep);
+		size = be32_to_cpup((__force __be32 *)sizep);
+		base = be64_to_cpup((__force __be64 *)basep);
 	} else {
 		size = *sizep;
 		base = *basep;
Signature · 1 line
2.17.0.484.g0c8726318c-goog
#1 lore raw
Quoted 23 lines · Thiebaud Weksteen
---
 drivers/char/tpm/tpm_eventlog_of.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_eventlog_of.c +2 -2
index 96fd5646f866..ea0f16f19d73 100644
@@ -56,8 +56,8 @@ int tpm_read_log_of(struct tpm_chip *chip)
 	 * but physical tpm needs the conversion.
 	 */
 	if (of_property_match_string(np, "compatible", "IBM,vtpm") < 0) {
-		size = be32_to_cpup(sizep);
-		base = be64_to_cpup(basep);
+		size = be32_to_cpup((__force __be32 *)sizep);
+		base = be64_to_cpup((__force __be64 *)basep);
 	} else {
 		size = *sizep;
 		base = *basep;
Signature · 1 line
2.17.0.484.g0c8726318c-goog

Repeal and replace, right (no change log)?

/Jarkko

#2 lore raw
Quoted 7 lines · Jarkko Sakkinen

Review

Quoted 6 lines · Thiebaud Weksteen
---
 drivers/char/tpm/tpm_eventlog_of.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/char/tpm/tpm_eventlog_of.c

Quoted 11 lines
Quoted 11 lines

index 96fd5646f866..ea0f16f19d73 100644

drivers/char/tpm/tpm_eventlog_of.c +2 -2
@@ -56,8 +56,8 @@ int tpm_read_log_of(struct tpm_chip *chip)
       * but physical tpm needs the conversion.
       */
      if (of_property_match_string(np, "compatible", "IBM,vtpm") < 0) {
-             size = be32_to_cpup(sizep);
-             base = be64_to_cpup(basep);
+             size = be32_to_cpup((__force __be32 *)sizep);
+             base = be64_to_cpup((__force __be64 *)basep);
Quoted 8 lines
Quoted 6 lines
drivers/char/tpm/tpm_eventlog_of.c +0 -1
      } else {
              size = *sizep;
              base = *basep;
--

2.17.0.484.g0c8726318c-goog

Repeal and replace, right (no change log)?

Yep, that's right. Thanks.

Quoted 1 line

/Jarkko

#3 lore raw
Quoted 31 lines · Thiebaud Weksteen
Quoted 7 lines · Jarkko Sakkinen

Review

Quoted 6 lines · Thiebaud Weksteen
---
 drivers/char/tpm/tpm_eventlog_of.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/char/tpm/tpm_eventlog_of.c

Quoted 11 lines
Quoted 11 lines

index 96fd5646f866..ea0f16f19d73 100644

drivers/char/tpm/tpm_eventlog_of.c +2 -2
@@ -56,8 +56,8 @@ int tpm_read_log_of(struct tpm_chip *chip)
       * but physical tpm needs the conversion.
       */
      if (of_property_match_string(np, "compatible", "IBM,vtpm") < 0) {
-             size = be32_to_cpup(sizep);
-             base = be64_to_cpup(basep);
+             size = be32_to_cpup((__force __be32 *)sizep);
+             base = be64_to_cpup((__force __be64 *)basep);
Quoted 8 lines
Quoted 6 lines
drivers/char/tpm/tpm_eventlog_of.c +0 -1
      } else {
              size = *sizep;
              base = *basep;
--

2.17.0.484.g0c8726318c-goog

Repeal and replace, right (no change log)?

Quoted 1 line

Yep, that's right. Thanks.

Done.

/Jarkko