All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kylene Jo Hall <kjhall@us.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tpm: improve output in sysfs files when the TPM fails
Date: Tue, 14 Jun 2005 10:00:26 -0500	[thread overview]
Message-ID: <1118761226.6602.60.camel@localhost.localdomain> (raw)
In-Reply-To: <20050513223003.4f9dc539.akpm@osdl.org>

On Fri, 2005-05-13 at 22:30 -0700, Andrew Morton wrote:
> Will this change permit unprivileged users to create large amounts of
> syslog output?  If so, this is considered poor form.
> 
> IOW: please confirm that the relevant sysfs files are root-read-only?
> 
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.  Is this sufficient?  Also this patch
corrects a memory leak if the error path is taken in the tpm_show_pubek
function.

Thanks,
Kylie Hall

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
---
--- linux-2.6.12-rc6-mm1/drivers/char/tpm/tpm.c.orig	2005-06-14 09:14:37.000000000 -0500
+++ linux-2.6.12-rc6-mm1/drivers/char/tpm/tpm.c	2005-06-14 09:24:23.000000000 -0500
@@ -147,7 +147,7 @@ ssize_t tpm_show_pcrs(struct device *dev
 	memcpy(data, cap_pcr, sizeof(cap_pcr));
 	if ((len = tpm_transmit(chip, data, sizeof(data)))
 	    < 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",
 			be32_to_cpu(*((__be32 *) (data + 6))));
 		return 0;
@@ -161,7 +161,7 @@ ssize_t tpm_show_pcrs(struct device *dev
 		memcpy(data + 10, &index, 4);
 		if ((len = tpm_transmit(chip, data, sizeof(data)))
 		    < 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",
 				be32_to_cpu(*((__be32 *) (data + 6))), i, num_pcrs);
 			goto out;
@@ -205,10 +205,11 @@ ssize_t tpm_show_pubek(struct device *de
 
 	if ((len = tpm_transmit(chip, data, 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",
 			    be32_to_cpu(*((__be32 *) (data + 6))));
-		return 0;
+		rc = 0;
+		goto out;
 	}
 
 	/* 
@@ -240,6 +241,7 @@ ssize_t tpm_show_pubek(struct device *de
 			str += sprintf(str, "\n");
 	}
 	rc = str - buf;
+out:
 	kfree(data);
 	return rc;
 }



      parent reply	other threads:[~2005-06-14 15:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-12 22:20 [PATCH] tpm: improve output in sysfs files when the TPM fails Kylene Hall
2005-05-12 22:55 ` Greg KH
2005-05-13 19:25   ` Kylene Hall
2005-05-14  5:30     ` Andrew Morton
2005-05-16 17:33       ` Kylene Hall
2005-06-14 15:00       ` Kylene Jo Hall [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1118761226.6602.60.camel@localhost.localdomain \
    --to=kjhall@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.