On Thursday, January 6, 2005 12:25 pm, Jesse Barnes wrote:
> [Sorry about the bogus reply, I don't have the original message.]
>
> That shouldn't happen. Maybe you were running an old version of the tree
> or an old version of my sysfs mmap patch? When I do a 'bk pull' of
> gregkh's latest usb tree into a recent Linus tree, I get an -EINVAL, not an
> oops. An earlier version of my patch had this bug though, so maybe that's
> what you're seeing?
Ugg. How about this?
Zero out newly allocated bin_attributes for legacy I/O, memory and resource
files since we won't fill in all of the file operation methods. This will
allow the checks in bin.c for the existence of a method to work properly
instead of checking garbage memory.
Signed-off-by: Jesse Barnes <[EMAIL PROTECTED]>
Jesse
===== drivers/pci/pci-sysfs.c 1.15 vs edited =====
--- 1.15/drivers/pci/pci-sysfs.c 2004-12-21 14:03:35 -08:00
+++ edited/drivers/pci/pci-sysfs.c 2005-01-06 12:30:29 -08:00
@@ -295,6 +295,7 @@
res_attr = kmalloc(sizeof(*res_attr) + 10, GFP_ATOMIC);
if (res_attr) {
+ memset(res_attr, 0, sizeof(*res_attr) + 10);
pdev->res_attr[i] = res_attr;
/* Allocated above after the res_attr struct */
res_attr->attr.name = (char *)(res_attr + 1);
===== drivers/pci/probe.c 1.73 vs edited =====
--- 1.73/drivers/pci/probe.c 2004-12-22 10:28:40 -08:00
+++ edited/drivers/pci/probe.c 2005-01-06 12:32:19 -08:00
@@ -41,6 +41,7 @@
b->legacy_io = kmalloc(sizeof(struct bin_attribute) * 2,
GFP_ATOMIC);
if (b->legacy_io) {
+ memset(b->legacy_io, 0, sizeof(struct bin_attribute) * 2);
b->legacy_io->attr.name = "legacy_io";
b->legacy_io->size = 0xffff;
b->legacy_io->attr.mode = S_IRUSR | S_IWUSR;