diff options
author | Kylene Jo Hall <kjhall@us.ibm.com> | 2005-06-25 17:55:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 19:24:38 -0400 |
commit | 6f9beccb95a47a15e446f64fbb7041dc6edce4d9 (patch) | |
tree | 9ea03f6cdf07073444f1f2ac09d2b7f9204a3140 /drivers | |
parent | 1dda8abe6feb906306a627b170654ddd8addcdac (diff) |
[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) | |||
464 | 464 | ||
465 | pci_set_drvdata(pci_dev, NULL); | 465 | pci_set_drvdata(pci_dev, NULL); |
466 | misc_deregister(&chip->vendor->miscdev); | 466 | misc_deregister(&chip->vendor->miscdev); |
467 | kfree(&chip->vendor->miscdev.name); | ||
467 | 468 | ||
468 | sysfs_remove_group(&pci_dev->dev.kobj, chip->vendor->attr_group); | 469 | sysfs_remove_group(&pci_dev->dev.kobj, chip->vendor->attr_group); |
469 | 470 | ||
@@ -526,7 +527,9 @@ EXPORT_SYMBOL_GPL(tpm_pm_resume); | |||
526 | int tpm_register_hardware(struct pci_dev *pci_dev, | 527 | int tpm_register_hardware(struct pci_dev *pci_dev, |
527 | struct tpm_vendor_specific *entry) | 528 | struct tpm_vendor_specific *entry) |
528 | { | 529 | { |
529 | char devname[7]; | 530 | #define DEVNAME_SIZE 7 |
531 | |||
532 | char *devname; | ||
530 | struct tpm_chip *chip; | 533 | struct tpm_chip *chip; |
531 | int i, j; | 534 | int i, j; |
532 | 535 | ||
@@ -569,7 +572,8 @@ dev_num_search_complete: | |||
569 | else | 572 | else |
570 | chip->vendor->miscdev.minor = MISC_DYNAMIC_MINOR; | 573 | chip->vendor->miscdev.minor = MISC_DYNAMIC_MINOR; |
571 | 574 | ||
572 | snprintf(devname, sizeof(devname), "%s%d", "tpm", chip->dev_num); | 575 | devname = kmalloc(DEVNAME_SIZE, GFP_KERNEL); |
576 | scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); | ||
573 | chip->vendor->miscdev.name = devname; | 577 | chip->vendor->miscdev.name = devname; |
574 | 578 | ||
575 | chip->vendor->miscdev.dev = &(pci_dev->dev); | 579 | chip->vendor->miscdev.dev = &(pci_dev->dev); |