include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / char / tpm / tpm_bios.c
index 4b26ce4..0636520 100644 (file)
@@ -7,6 +7,8 @@
  *     Reiner Sailer <sailer@watson.ibm.com>
  *     Kylene Hall <kjhall@us.ibm.com>
  *
+ * Maintained by: <tpmdd-devel@lists.sourceforge.net>
+ *
  * Access to the eventlog extended by the TCG BIOS of PC platform
  *
  * This program is free software; you can redistribute it and/or
@@ -20,9 +22,8 @@
 #include <linux/fs.h>
 #include <linux/security.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 #include <acpi/acpi.h>
-#include <acpi/actypes.h>
-#include <acpi/actbl.h>
 #include "tpm.h"
 
 #define TCG_EVENT_NAME_LEN_MAX 255
@@ -212,7 +213,8 @@ static int get_event_name(char *dest, struct tcpa_event *event,
                        unsigned char * event_entry)
 {
        const char *name = "";
-       char data[40] = "";
+       /* 41 so there is room for 40 data and 1 nul */
+       char data[41] = "";
        int i, n_len = 0, d_len = 0;
        struct tcpa_pc_event *pc_event;
 
@@ -342,14 +344,14 @@ static int tpm_ascii_bios_measurements_show(struct seq_file *m, void *v)
        return 0;
 }
 
-static struct seq_operations tpm_ascii_b_measurments_seqops = {
+static const struct seq_operations tpm_ascii_b_measurments_seqops = {
        .start = tpm_bios_measurements_start,
        .next = tpm_bios_measurements_next,
        .stop = tpm_bios_measurements_stop,
        .show = tpm_ascii_bios_measurements_show,
 };
 
-static struct seq_operations tpm_binary_b_measurments_seqops = {
+static const struct seq_operations tpm_binary_b_measurments_seqops = {
        .start = tpm_bios_measurements_start,
        .next = tpm_bios_measurements_next,
        .stop = tpm_bios_measurements_stop,
@@ -446,7 +448,7 @@ out_free:
        goto out;
 }
 
-const struct file_operations tpm_ascii_bios_measurements_ops = {
+static const struct file_operations tpm_ascii_bios_measurements_ops = {
        .open = tpm_ascii_bios_measurements_open,
        .read = seq_read,
        .llseek = seq_lseek,
@@ -465,7 +467,7 @@ static int tpm_binary_bios_measurements_open(struct inode *inode,
                return -ENOMEM;
 
        if ((err = read_log(log)))
-               return err;
+               goto out_free;
 
        /* now register seq file */
        err = seq_open(file, &tpm_binary_b_measurments_seqops);
@@ -473,13 +475,18 @@ static int tpm_binary_bios_measurements_open(struct inode *inode,
                seq = file->private_data;
                seq->private = log;
        } else {
-               kfree(log->bios_event_log);
-               kfree(log);
+               goto out_free;
        }
+
+out:
        return err;
+out_free:
+       kfree(log->bios_event_log);
+       kfree(log);
+       goto out;
 }
 
-const struct file_operations tpm_binary_bios_measurements_ops = {
+static const struct file_operations tpm_binary_bios_measurements_ops = {
        .open = tpm_binary_bios_measurements_open,
        .read = seq_read,
        .llseek = seq_lseek,