diff options
author | Kylene Jo Hall <kjhall@us.ibm.com> | 2005-06-25 14:55:41 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 16:24:38 -0700 |
commit | 6f9beccb95a47a15e446f64fbb7041dc6edce4d9 (patch) | |
tree | 9ea03f6cdf07073444f1f2ac09d2b7f9204a3140 /drivers | |
parent | 1dda8abe6feb906306a627b170654ddd8addcdac (diff) | |
download | linux-6f9beccb95a47a15e446f64fbb7041dc6edce4d9.tar.gz linux-6f9beccb95a47a15e446f64fbb7041dc6edce4d9.tar.bz2 linux-6f9beccb95a47a15e446f64fbb7041dc6edce4d9.zip |
[PATCH] tpm: fix misc name memory problem
I was using invalid memory for the miscdevice.name. This patch fixes the
problem which was manifested by an ugly entry in /proc/misc.
Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/tpm/tpm.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 1156d11f02d9..854475c54f0e 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c @@ -464,6 +464,7 @@ void __devexit tpm_remove(struct pci_dev *pci_dev) pci_set_drvdata(pci_dev, NULL); misc_deregister(&chip->vendor->miscdev); + kfree(&chip->vendor->miscdev.name); sysfs_remove_group(&pci_dev->dev.kobj, chip->vendor->attr_group); @@ -526,7 +527,9 @@ EXPORT_SYMBOL_GPL(tpm_pm_resume); int tpm_register_hardware(struct pci_dev *pci_dev, struct tpm_vendor_specific *entry) { - char devname[7]; +#define DEVNAME_SIZE 7 + + char *devname; struct tpm_chip *chip; int i, j; @@ -569,7 +572,8 @@ dev_num_search_complete: else chip->vendor->miscdev.minor = MISC_DYNAMIC_MINOR; - snprintf(devname, sizeof(devname), "%s%d", "tpm", chip->dev_num); + devname = kmalloc(DEVNAME_SIZE, GFP_KERNEL); + scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); chip->vendor->miscdev.name = devname; chip->vendor->miscdev.dev = &(pci_dev->dev); |