Skip to contentSkip to conversation

sysfs: export the vfs release call of binary attribute

PATCH Applied Kay Sievers 2 participants 3 messages Jan 27, 2005 – Feb 1, 2005 PCI

lore
Share & tools
lore
#0 lore raw

Initialize the allocated bin_attribute structure, otherwise unused fields are pointing to random places.

===== drivers/pci/pci-sysfs.c 1.16 vs edited =====

drivers/pci/pci-sysfs.c +1 -0
@@ -435,6 +435,7 @@ int pci_create_sysfs_dev_files (struct p
 		struct bin_attribute *rom_attr;
 		
 		rom_attr = kmalloc(sizeof(*rom_attr), GFP_ATOMIC);
+		memset(rom_attr, 0x00, sizeof(*rom_attr));
 		if (rom_attr) {
 			pdev->rom_attr = rom_attr;
 			rom_attr->size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
#1 lore raw
Quoted 2 lines · Kay Sievers

Initialize the allocated bin_attribute structure, otherwise unused fields are pointing to random places.

Sorry, wrong place for the inititalization.

===== drivers/pci/pci-sysfs.c 1.16 vs edited =====

drivers/pci/pci-sysfs.c +1 -0
@@ -436,6 +436,7 @@ int pci_create_sysfs_dev_files (struct p
 		
 		rom_attr = kmalloc(sizeof(*rom_attr), GFP_ATOMIC);
 		if (rom_attr) {
+			memset(rom_attr, 0x00, sizeof(*rom_attr));
 			pdev->rom_attr = rom_attr;
 			rom_attr->size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
 			rom_attr->attr.name = "rom";
Applied
#2 lore raw
Quoted 7 lines · Kay Sievers
Quoted 2 lines · Kay Sievers

Initialize the allocated bin_attribute structure, otherwise unused fields are pointing to random places.

Sorry, wrong place for the inititalization.

Applied, thanks.

greg k-h