aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/ebus.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-10-27 04:03:31 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-10-27 04:03:31 -0400
commitf5ef9d11fd255b30b455d18f8d721bc44cd1296b (patch)
tree61a31b476ac98c05bf0210b169171aa6afb3e007 /arch/sparc/kernel/ebus.c
parente80391500078b524083ba51c3df01bbaaecc94bb (diff)
[SPARC]: Fix bus_id[] string overflow.
dp->path_component_name can be larger than ->bus_id[] so use a different naming scheme for this stuff. Noticed by Jurij Smakov. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/ebus.c')
-rw-r--r--arch/sparc/kernel/ebus.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c
index 75ac24d229b1..ba58c3a061fd 100644
--- a/arch/sparc/kernel/ebus.c
+++ b/arch/sparc/kernel/ebus.c
@@ -237,12 +237,12 @@ void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *d
237 dev->ofdev.node = dp; 237 dev->ofdev.node = dp;
238 dev->ofdev.dev.parent = &dev->bus->ofdev.dev; 238 dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
239 dev->ofdev.dev.bus = &ebus_bus_type; 239 dev->ofdev.dev.bus = &ebus_bus_type;
240 strcpy(dev->ofdev.dev.bus_id, dp->path_component_name); 240 sprintf(dev->ofdev.dev.bus_id, "ebus[%08x]", dp->node);
241 241
242 /* Register with core */ 242 /* Register with core */
243 if (of_device_register(&dev->ofdev) != 0) 243 if (of_device_register(&dev->ofdev) != 0)
244 printk(KERN_DEBUG "ebus: device registration error for %s!\n", 244 printk(KERN_DEBUG "ebus: device registration error for %s!\n",
245 dev->ofdev.dev.bus_id); 245 dp->path_component_name);
246 246
247 if ((dp = dp->child) != NULL) { 247 if ((dp = dp->child) != NULL) {
248 dev->children = (struct linux_ebus_child *) 248 dev->children = (struct linux_ebus_child *)
@@ -332,12 +332,12 @@ void __init ebus_init(void)
332 ebus->ofdev.node = dp; 332 ebus->ofdev.node = dp;
333 ebus->ofdev.dev.parent = &pdev->dev; 333 ebus->ofdev.dev.parent = &pdev->dev;
334 ebus->ofdev.dev.bus = &ebus_bus_type; 334 ebus->ofdev.dev.bus = &ebus_bus_type;
335 strcpy(ebus->ofdev.dev.bus_id, dp->path_component_name); 335 sprintf(ebus->ofdev.dev.bus_id, "ebus%d", num_ebus);
336 336
337 /* Register with core */ 337 /* Register with core */
338 if (of_device_register(&ebus->ofdev) != 0) 338 if (of_device_register(&ebus->ofdev) != 0)
339 printk(KERN_DEBUG "ebus: device registration error for %s!\n", 339 printk(KERN_DEBUG "ebus: device registration error for %s!\n",
340 ebus->ofdev.dev.bus_id); 340 dp->path_component_name);
341 341
342 342
343 nd = dp->child; 343 nd = dp->child;