mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] [REPOST] tpm: suppress durations sysfs output if not read
@ 2011-08-23 12:52 Stefan Berger
  2011-08-23 23:31 ` James Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Berger @ 2011-08-23 12:52 UTC (permalink / raw)
  To: linux-kernel, James Morris, Rajiv Andrade, m.selhorst

Suppress the output in the 'durations' sysfs entry if they were not read
during driver initialization. This is similar to other sysfs entries
that return nothing if for some reason sending the commands to the TPM
fails.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>

---
 drivers/char/tpm/tpm.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-2.6/drivers/char/tpm/tpm.c
===================================================================
--- linux-2.6.orig/drivers/char/tpm/tpm.c
+++ linux-2.6/drivers/char/tpm/tpm.c
@@ -963,6 +963,9 @@ ssize_t tpm_show_durations(struct device
 {
 	struct tpm_chip *chip = dev_get_drvdata(dev);
 
+	if (chip->vendor.duration[TPM_LONG] == 0)
+		return 0;
+
 	return sprintf(buf, "%d %d %d [%s]\n",
 		       jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]),
 		       jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]),


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] [REPOST] tpm: suppress durations sysfs output if not read
  2011-08-23 12:52 [PATCH] [REPOST] tpm: suppress durations sysfs output if not read Stefan Berger
@ 2011-08-23 23:31 ` James Morris
  0 siblings, 0 replies; 2+ messages in thread
From: James Morris @ 2011-08-23 23:31 UTC (permalink / raw)
  To: Stefan Berger; +Cc: linux-kernel, Rajiv Andrade, m.selhorst

On Tue, 23 Aug 2011, Stefan Berger wrote:

> Suppress the output in the 'durations' sysfs entry if they were not read
> during driver initialization. This is similar to other sysfs entries
> that return nothing if for some reason sending the commands to the TPM
> fails.
> 
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next


> 
> ---
>  drivers/char/tpm/tpm.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> Index: linux-2.6/drivers/char/tpm/tpm.c
> ===================================================================
> --- linux-2.6.orig/drivers/char/tpm/tpm.c
> +++ linux-2.6/drivers/char/tpm/tpm.c
> @@ -963,6 +963,9 @@ ssize_t tpm_show_durations(struct device
>  {
>  	struct tpm_chip *chip = dev_get_drvdata(dev);
>  
> +	if (chip->vendor.duration[TPM_LONG] == 0)
> +		return 0;
> +
>  	return sprintf(buf, "%d %d %d [%s]\n",
>  		       jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]),
>  		       jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]),
> 

-- 
James Morris
<jmorris@namei.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-23 23:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-23 12:52 [PATCH] [REPOST] tpm: suppress durations sysfs output if not read Stefan Berger
2011-08-23 23:31 ` James Morris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®