Commit 34d6e075 authored by Kylene Jo Hall's avatar Kylene Jo Hall Committed by Linus Torvalds

[PATCH] tpm: improve output in sysfs files when the TPM fails

Since after reconsideration this is more debug output than an error (the
TPM is operating correctly given the current state) I have changed the
statements to dbg rather than err.

Also this patch corrects a memory leak if the error path is taken in the
tpm_show_pubek function.
Signed-off-by: default avatarKylene Hall <kjhall@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e234bc97
...@@ -147,7 +147,7 @@ ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr, ...@@ -147,7 +147,7 @@ ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr,
memcpy(data, cap_pcr, sizeof(cap_pcr)); memcpy(data, cap_pcr, sizeof(cap_pcr));
if ((len = tpm_transmit(chip, data, sizeof(data))) if ((len = tpm_transmit(chip, data, sizeof(data)))
< CAP_PCR_RESULT_SIZE) { < CAP_PCR_RESULT_SIZE) {
dev_err(&chip->pci_dev->dev, "A TPM error (%d) occurred " dev_dbg(&chip->pci_dev->dev, "A TPM error (%d) occurred "
"attempting to determine the number of PCRS\n", "attempting to determine the number of PCRS\n",
be32_to_cpu(*((__be32 *) (data + 6)))); be32_to_cpu(*((__be32 *) (data + 6))));
return 0; return 0;
...@@ -161,7 +161,7 @@ ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr, ...@@ -161,7 +161,7 @@ ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr,
memcpy(data + 10, &index, 4); memcpy(data + 10, &index, 4);
if ((len = tpm_transmit(chip, data, sizeof(data))) if ((len = tpm_transmit(chip, data, sizeof(data)))
< READ_PCR_RESULT_SIZE){ < READ_PCR_RESULT_SIZE){
dev_err(&chip->pci_dev->dev, "A TPM error (%d) occurred" dev_dbg(&chip->pci_dev->dev, "A TPM error (%d) occurred"
" attempting to read PCR %d of %d\n", " attempting to read PCR %d of %d\n",
be32_to_cpu(*((__be32 *) (data + 6))), i, num_pcrs); be32_to_cpu(*((__be32 *) (data + 6))), i, num_pcrs);
goto out; goto out;
...@@ -205,10 +205,11 @@ ssize_t tpm_show_pubek(struct device *dev, struct device_attribute *attr, ...@@ -205,10 +205,11 @@ ssize_t tpm_show_pubek(struct device *dev, struct device_attribute *attr,
if ((len = tpm_transmit(chip, data, READ_PUBEK_RESULT_SIZE)) < if ((len = tpm_transmit(chip, data, READ_PUBEK_RESULT_SIZE)) <
READ_PUBEK_RESULT_SIZE) { READ_PUBEK_RESULT_SIZE) {
dev_err(&chip->pci_dev->dev, "A TPM error (%d) occurred " dev_dbg(&chip->pci_dev->dev, "A TPM error (%d) occurred "
"attempting to read the PUBEK\n", "attempting to read the PUBEK\n",
be32_to_cpu(*((__be32 *) (data + 6)))); be32_to_cpu(*((__be32 *) (data + 6))));
return 0; rc = 0;
goto out;
} }
/* /*
...@@ -240,6 +241,7 @@ ssize_t tpm_show_pubek(struct device *dev, struct device_attribute *attr, ...@@ -240,6 +241,7 @@ ssize_t tpm_show_pubek(struct device *dev, struct device_attribute *attr,
str += sprintf(str, "\n"); str += sprintf(str, "\n");
} }
rc = str - buf; rc = str - buf;
out:
kfree(data); kfree(data);
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment