Commit 48711f91 authored by Jesse Barnes's avatar Jesse Barnes Committed by David Mosberger

[PATCH] ia64: zero out topology related sysfs nodes

Tony pointed out (thanks Tony) that in -test8 kobject_set_name() will
try to free a kobject's k_name field if it's non-NULL, so we need to
zero it out in case kmalloc() gave us recycled memory or we'll try to
kfree a bogus area.
parent e360aa91
...@@ -60,6 +60,7 @@ static int __init topology_init(void) ...@@ -60,6 +60,7 @@ static int __init topology_init(void)
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
} }
memset(sysfs_nodes, 0, sizeof(struct node) * numnodes);
sysfs_memblks = kmalloc(sizeof(struct memblk) * num_memblks, sysfs_memblks = kmalloc(sizeof(struct memblk) * num_memblks,
GFP_KERNEL); GFP_KERNEL);
...@@ -68,6 +69,7 @@ static int __init topology_init(void) ...@@ -68,6 +69,7 @@ static int __init topology_init(void)
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
} }
memset(sysfs_memblks, 0, sizeof(struct memblk) * num_memblks);
sysfs_cpus = kmalloc(sizeof(struct cpu) * NR_CPUS, GFP_KERNEL); sysfs_cpus = kmalloc(sizeof(struct cpu) * NR_CPUS, GFP_KERNEL);
if (!sysfs_cpus) { if (!sysfs_cpus) {
...@@ -76,6 +78,7 @@ static int __init topology_init(void) ...@@ -76,6 +78,7 @@ static int __init topology_init(void)
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
} }
memset(sysfs_cpus, 0, sizeof(struct cpu) * NR_CPUS);
for (i = 0; i < numnodes; i++) for (i = 0; i < numnodes; i++)
if ((err = register_node(&sysfs_nodes[i], i, 0))) if ((err = register_node(&sysfs_nodes[i], i, 0)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment