diff options
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r-- | drivers/char/tpm/tpm.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 39e82314d67f..84b2d46e6ff0 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -143,11 +143,9 @@ static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, | |||
143 | { | 143 | { |
144 | ssize_t len; | 144 | ssize_t len; |
145 | u32 count; | 145 | u32 count; |
146 | __be32 *native_size; | ||
147 | unsigned long stop; | 146 | unsigned long stop; |
148 | 147 | ||
149 | native_size = (__force __be32 *) (buf + 2); | 148 | count = be32_to_cpu(*((__be32 *) (buf + 2))); |
150 | count = be32_to_cpu(*native_size); | ||
151 | 149 | ||
152 | if (count == 0) | 150 | if (count == 0) |
153 | return -ENODATA; | 151 | return -ENODATA; |
@@ -214,7 +212,8 @@ static ssize_t show_pcrs(struct device *dev, struct device_attribute *attr, char | |||
214 | { | 212 | { |
215 | u8 data[READ_PCR_RESULT_SIZE]; | 213 | u8 data[READ_PCR_RESULT_SIZE]; |
216 | ssize_t len; | 214 | ssize_t len; |
217 | int i, j, index, num_pcrs; | 215 | int i, j, num_pcrs; |
216 | __be32 index; | ||
218 | char *str = buf; | 217 | char *str = buf; |
219 | 218 | ||
220 | struct tpm_chip *chip = | 219 | struct tpm_chip *chip = |
@@ -227,7 +226,7 @@ static ssize_t show_pcrs(struct device *dev, struct device_attribute *attr, char | |||
227 | < CAP_PCR_RESULT_SIZE) | 226 | < CAP_PCR_RESULT_SIZE) |
228 | return len; | 227 | return len; |
229 | 228 | ||
230 | num_pcrs = be32_to_cpu(*((__force __be32 *) (data + 14))); | 229 | num_pcrs = be32_to_cpu(*((__be32 *) (data + 14))); |
231 | 230 | ||
232 | for (i = 0; i < num_pcrs; i++) { | 231 | for (i = 0; i < num_pcrs; i++) { |
233 | memcpy(data, pcrread, sizeof(pcrread)); | 232 | memcpy(data, pcrread, sizeof(pcrread)); |
@@ -257,8 +256,7 @@ static ssize_t show_pubek(struct device *dev, struct device_attribute *attr, cha | |||
257 | { | 256 | { |
258 | u8 *data; | 257 | u8 *data; |
259 | ssize_t len; | 258 | ssize_t len; |
260 | __be32 *native_val; | 259 | int i, rc; |
261 | int i; | ||
262 | char *str = buf; | 260 | char *str = buf; |
263 | 261 | ||
264 | struct tpm_chip *chip = | 262 | struct tpm_chip *chip = |
@@ -290,8 +288,6 @@ static ssize_t show_pubek(struct device *dev, struct device_attribute *attr, cha | |||
290 | ignore checksum 20 bytes | 288 | ignore checksum 20 bytes |
291 | */ | 289 | */ |
292 | 290 | ||
293 | native_val = (__force __be32 *) (data + 34); | ||
294 | |||
295 | str += | 291 | str += |
296 | sprintf(str, | 292 | sprintf(str, |
297 | "Algorithm: %02X %02X %02X %02X\nEncscheme: %02X %02X\n" | 293 | "Algorithm: %02X %02X %02X %02X\nEncscheme: %02X %02X\n" |
@@ -302,8 +298,7 @@ static ssize_t show_pubek(struct device *dev, struct device_attribute *attr, cha | |||
302 | data[15], data[16], data[17], data[22], data[23], | 298 | data[15], data[16], data[17], data[22], data[23], |
303 | data[24], data[25], data[26], data[27], data[28], | 299 | data[24], data[25], data[26], data[27], data[28], |
304 | data[29], data[30], data[31], data[32], data[33], | 300 | data[29], data[30], data[31], data[32], data[33], |
305 | be32_to_cpu(*native_val) | 301 | be32_to_cpu(*((__be32 *) (data + 32)))); |
306 | ); | ||
307 | 302 | ||
308 | for (i = 0; i < 256; i++) { | 303 | for (i = 0; i < 256; i++) { |
309 | str += sprintf(str, "%02X ", data[i + 39]); | 304 | str += sprintf(str, "%02X ", data[i + 39]); |
@@ -355,7 +350,7 @@ static ssize_t show_caps(struct device *dev, struct device_attribute *attr, char | |||
355 | return len; | 350 | return len; |
356 | 351 | ||
357 | str += sprintf(str, "Manufacturer: 0x%x\n", | 352 | str += sprintf(str, "Manufacturer: 0x%x\n", |
358 | be32_to_cpu(*(data + 14))); | 353 | be32_to_cpu(*((__be32 *) (data + 14)))); |
359 | 354 | ||
360 | memcpy(data, cap_version, sizeof(cap_version)); | 355 | memcpy(data, cap_version, sizeof(cap_version)); |
361 | 356 | ||