aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r--drivers/char/tpm/tpm.c7
-rw-r--r--drivers/char/tpm/tpm_bios.c4
2 files changed, 5 insertions, 6 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index f4c68abf2a15..aeafac5bde8c 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -696,7 +696,7 @@ int __tpm_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf)
696 696
697 cmd.header.in = pcrread_header; 697 cmd.header.in = pcrread_header;
698 cmd.params.pcrread_in.pcr_idx = cpu_to_be32(pcr_idx); 698 cmd.params.pcrread_in.pcr_idx = cpu_to_be32(pcr_idx);
699 BUILD_BUG_ON(cmd.header.in.length > READ_PCR_RESULT_SIZE); 699 BUG_ON(cmd.header.in.length > READ_PCR_RESULT_SIZE);
700 rc = transmit_cmd(chip, &cmd, cmd.header.in.length, 700 rc = transmit_cmd(chip, &cmd, cmd.header.in.length,
701 "attempting to read a pcr value"); 701 "attempting to read a pcr value");
702 702
@@ -742,7 +742,7 @@ EXPORT_SYMBOL_GPL(tpm_pcr_read);
742 * the module usage count. 742 * the module usage count.
743 */ 743 */
744#define TPM_ORD_PCR_EXTEND cpu_to_be32(20) 744#define TPM_ORD_PCR_EXTEND cpu_to_be32(20)
745#define EXTEND_PCR_SIZE 34 745#define EXTEND_PCR_RESULT_SIZE 34
746static struct tpm_input_header pcrextend_header = { 746static struct tpm_input_header pcrextend_header = {
747 .tag = TPM_TAG_RQU_COMMAND, 747 .tag = TPM_TAG_RQU_COMMAND,
748 .length = cpu_to_be32(34), 748 .length = cpu_to_be32(34),
@@ -760,10 +760,9 @@ int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash)
760 return -ENODEV; 760 return -ENODEV;
761 761
762 cmd.header.in = pcrextend_header; 762 cmd.header.in = pcrextend_header;
763 BUILD_BUG_ON(be32_to_cpu(cmd.header.in.length) > EXTEND_PCR_SIZE);
764 cmd.params.pcrextend_in.pcr_idx = cpu_to_be32(pcr_idx); 763 cmd.params.pcrextend_in.pcr_idx = cpu_to_be32(pcr_idx);
765 memcpy(cmd.params.pcrextend_in.hash, hash, TPM_DIGEST_SIZE); 764 memcpy(cmd.params.pcrextend_in.hash, hash, TPM_DIGEST_SIZE);
766 rc = transmit_cmd(chip, &cmd, cmd.header.in.length, 765 rc = transmit_cmd(chip, &cmd, EXTEND_PCR_RESULT_SIZE,
767 "attempting extend a PCR value"); 766 "attempting extend a PCR value");
768 767
769 module_put(chip->dev->driver->owner); 768 module_put(chip->dev->driver->owner);
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c
index 0c2f55a38b95..bf2170fb1cdd 100644
--- a/drivers/char/tpm/tpm_bios.c
+++ b/drivers/char/tpm/tpm_bios.c
@@ -343,14 +343,14 @@ static int tpm_ascii_bios_measurements_show(struct seq_file *m, void *v)
343 return 0; 343 return 0;
344} 344}
345 345
346static struct seq_operations tpm_ascii_b_measurments_seqops = { 346static const struct seq_operations tpm_ascii_b_measurments_seqops = {
347 .start = tpm_bios_measurements_start, 347 .start = tpm_bios_measurements_start,
348 .next = tpm_bios_measurements_next, 348 .next = tpm_bios_measurements_next,
349 .stop = tpm_bios_measurements_stop, 349 .stop = tpm_bios_measurements_stop,
350 .show = tpm_ascii_bios_measurements_show, 350 .show = tpm_ascii_bios_measurements_show,
351}; 351};
352 352
353static struct seq_operations tpm_binary_b_measurments_seqops = { 353static const struct seq_operations tpm_binary_b_measurments_seqops = {
354 .start = tpm_bios_measurements_start, 354 .start = tpm_bios_measurements_start,
355 .next = tpm_bios_measurements_next, 355 .next = tpm_bios_measurements_next,
356 .stop = tpm_bios_measurements_stop, 356 .stop = tpm_bios_measurements_stop,