diff options
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r-- | drivers/char/tpm/tpm_bios.c | 25 | ||||
-rw-r--r-- | drivers/char/tpm/tpm_infineon.c | 2 |
2 files changed, 18 insertions, 9 deletions
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c index aedf7a8e6da7..537aa45d8c67 100644 --- a/drivers/char/tpm/tpm_bios.c +++ b/drivers/char/tpm/tpm_bios.c | |||
@@ -191,7 +191,7 @@ static int get_event_name(char *dest, struct tcpa_event *event, | |||
191 | const char *name = ""; | 191 | const char *name = ""; |
192 | char data[40] = ""; | 192 | char data[40] = ""; |
193 | int i, n_len = 0, d_len = 0; | 193 | int i, n_len = 0, d_len = 0; |
194 | u32 event_id, event_data_size; | 194 | u32 event_id; |
195 | 195 | ||
196 | switch(event->event_type) { | 196 | switch(event->event_type) { |
197 | case PREBOOT: | 197 | case PREBOOT: |
@@ -220,8 +220,7 @@ static int get_event_name(char *dest, struct tcpa_event *event, | |||
220 | } | 220 | } |
221 | break; | 221 | break; |
222 | case EVENT_TAG: | 222 | case EVENT_TAG: |
223 | event_id = be32_to_cpu(event_entry); | 223 | event_id = be32_to_cpu(*((u32 *)event_entry)); |
224 | event_data_size = be32_to_cpu(&event_entry[4]); | ||
225 | 224 | ||
226 | /* ToDo Row data -> Base64 */ | 225 | /* ToDo Row data -> Base64 */ |
227 | 226 | ||
@@ -376,7 +375,7 @@ static int read_log(struct tpm_bios_log *log) | |||
376 | { | 375 | { |
377 | struct acpi_tcpa *buff; | 376 | struct acpi_tcpa *buff; |
378 | acpi_status status; | 377 | acpi_status status; |
379 | void *virt; | 378 | struct acpi_table_header *virt; |
380 | 379 | ||
381 | if (log->bios_event_log != NULL) { | 380 | if (log->bios_event_log != NULL) { |
382 | printk(KERN_ERR | 381 | printk(KERN_ERR |
@@ -413,7 +412,7 @@ static int read_log(struct tpm_bios_log *log) | |||
413 | 412 | ||
414 | log->bios_event_log_end = log->bios_event_log + buff->log_max_len; | 413 | log->bios_event_log_end = log->bios_event_log + buff->log_max_len; |
415 | 414 | ||
416 | acpi_os_map_memory(buff->log_start_addr, buff->log_max_len, &virt); | 415 | acpi_os_map_memory(buff->log_start_addr, buff->log_max_len, (void *) &virt); |
417 | 416 | ||
418 | memcpy(log->bios_event_log, virt, buff->log_max_len); | 417 | memcpy(log->bios_event_log, virt, buff->log_max_len); |
419 | 418 | ||
@@ -487,26 +486,35 @@ struct file_operations tpm_binary_bios_measurements_ops = { | |||
487 | .release = tpm_bios_measurements_release, | 486 | .release = tpm_bios_measurements_release, |
488 | }; | 487 | }; |
489 | 488 | ||
489 | static int is_bad(void *p) | ||
490 | { | ||
491 | if (!p) | ||
492 | return 1; | ||
493 | if (IS_ERR(p) && (PTR_ERR(p) != -ENODEV)) | ||
494 | return 1; | ||
495 | return 0; | ||
496 | } | ||
497 | |||
490 | struct dentry **tpm_bios_log_setup(char *name) | 498 | struct dentry **tpm_bios_log_setup(char *name) |
491 | { | 499 | { |
492 | struct dentry **ret = NULL, *tpm_dir, *bin_file, *ascii_file; | 500 | struct dentry **ret = NULL, *tpm_dir, *bin_file, *ascii_file; |
493 | 501 | ||
494 | tpm_dir = securityfs_create_dir(name, NULL); | 502 | tpm_dir = securityfs_create_dir(name, NULL); |
495 | if (!tpm_dir) | 503 | if (is_bad(tpm_dir)) |
496 | goto out; | 504 | goto out; |
497 | 505 | ||
498 | bin_file = | 506 | bin_file = |
499 | securityfs_create_file("binary_bios_measurements", | 507 | securityfs_create_file("binary_bios_measurements", |
500 | S_IRUSR | S_IRGRP, tpm_dir, NULL, | 508 | S_IRUSR | S_IRGRP, tpm_dir, NULL, |
501 | &tpm_binary_bios_measurements_ops); | 509 | &tpm_binary_bios_measurements_ops); |
502 | if (!bin_file) | 510 | if (is_bad(bin_file)) |
503 | goto out_tpm; | 511 | goto out_tpm; |
504 | 512 | ||
505 | ascii_file = | 513 | ascii_file = |
506 | securityfs_create_file("ascii_bios_measurements", | 514 | securityfs_create_file("ascii_bios_measurements", |
507 | S_IRUSR | S_IRGRP, tpm_dir, NULL, | 515 | S_IRUSR | S_IRGRP, tpm_dir, NULL, |
508 | &tpm_ascii_bios_measurements_ops); | 516 | &tpm_ascii_bios_measurements_ops); |
509 | if (!ascii_file) | 517 | if (is_bad(ascii_file)) |
510 | goto out_bin; | 518 | goto out_bin; |
511 | 519 | ||
512 | ret = kmalloc(3 * sizeof(struct dentry *), GFP_KERNEL); | 520 | ret = kmalloc(3 * sizeof(struct dentry *), GFP_KERNEL); |
@@ -538,3 +546,4 @@ void tpm_bios_log_teardown(struct dentry **lst) | |||
538 | securityfs_remove(lst[i]); | 546 | securityfs_remove(lst[i]); |
539 | } | 547 | } |
540 | EXPORT_SYMBOL_GPL(tpm_bios_log_teardown); | 548 | EXPORT_SYMBOL_GPL(tpm_bios_log_teardown); |
549 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c index 8198dbb7370f..ec7590951af5 100644 --- a/drivers/char/tpm/tpm_infineon.c +++ b/drivers/char/tpm/tpm_infineon.c | |||
@@ -441,7 +441,7 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev, | |||
441 | 441 | ||
442 | if ((ioh << 8 | iol) != tpm_inf.base) { | 442 | if ((ioh << 8 | iol) != tpm_inf.base) { |
443 | dev_err(&dev->dev, | 443 | dev_err(&dev->dev, |
444 | "Could not set IO-ports to %04x\n", | 444 | "Could not set IO-ports to 0x%lx\n", |
445 | tpm_inf.base); | 445 | tpm_inf.base); |
446 | release_region(tpm_inf.base, TPM_INF_PORT_LEN); | 446 | release_region(tpm_inf.base, TPM_INF_PORT_LEN); |
447 | return -EIO; | 447 | return -EIO; |