diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-10-27 04:03:31 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-10-27 04:03:31 -0400 |
commit | f5ef9d11fd255b30b455d18f8d721bc44cd1296b (patch) | |
tree | 61a31b476ac98c05bf0210b169171aa6afb3e007 /arch/sparc64/kernel/ebus.c | |
parent | e80391500078b524083ba51c3df01bbaaecc94bb (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/sparc64/kernel/ebus.c')
-rw-r--r-- | arch/sparc64/kernel/ebus.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/sparc64/kernel/ebus.c b/arch/sparc64/kernel/ebus.c index 2df25c2b4071..35bf895fdeee 100644 --- a/arch/sparc64/kernel/ebus.c +++ b/arch/sparc64/kernel/ebus.c | |||
@@ -389,12 +389,12 @@ static void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_de | |||
389 | dev->ofdev.node = dp; | 389 | dev->ofdev.node = dp; |
390 | dev->ofdev.dev.parent = &dev->bus->ofdev.dev; | 390 | dev->ofdev.dev.parent = &dev->bus->ofdev.dev; |
391 | dev->ofdev.dev.bus = &ebus_bus_type; | 391 | dev->ofdev.dev.bus = &ebus_bus_type; |
392 | strcpy(dev->ofdev.dev.bus_id, dp->path_component_name); | 392 | sprintf(dev->ofdev.dev.bus_id, "ebus[%08x]", dp->node); |
393 | 393 | ||
394 | /* Register with core */ | 394 | /* Register with core */ |
395 | if (of_device_register(&dev->ofdev) != 0) | 395 | if (of_device_register(&dev->ofdev) != 0) |
396 | printk(KERN_DEBUG "ebus: device registration error for %s!\n", | 396 | printk(KERN_DEBUG "ebus: device registration error for %s!\n", |
397 | dev->ofdev.dev.bus_id); | 397 | dp->path_component_name); |
398 | 398 | ||
399 | dp = dp->child; | 399 | dp = dp->child; |
400 | if (dp) { | 400 | if (dp) { |
@@ -494,12 +494,12 @@ void __init ebus_init(void) | |||
494 | ebus->ofdev.node = dp; | 494 | ebus->ofdev.node = dp; |
495 | ebus->ofdev.dev.parent = &pdev->dev; | 495 | ebus->ofdev.dev.parent = &pdev->dev; |
496 | ebus->ofdev.dev.bus = &ebus_bus_type; | 496 | ebus->ofdev.dev.bus = &ebus_bus_type; |
497 | strcpy(ebus->ofdev.dev.bus_id, dp->path_component_name); | 497 | sprintf(ebus->ofdev.dev.bus_id, "ebus%d", num_ebus); |
498 | 498 | ||
499 | /* Register with core */ | 499 | /* Register with core */ |
500 | if (of_device_register(&ebus->ofdev) != 0) | 500 | if (of_device_register(&ebus->ofdev) != 0) |
501 | printk(KERN_DEBUG "ebus: device registration error for %s!\n", | 501 | printk(KERN_DEBUG "ebus: device registration error for %s!\n", |
502 | ebus->ofdev.dev.bus_id); | 502 | dp->path_component_name); |
503 | 503 | ||
504 | 504 | ||
505 | child = dp->child; | 505 | child = dp->child; |