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 | |
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')
-rw-r--r-- | arch/sparc64/kernel/ebus.c | 8 | ||||
-rw-r--r-- | arch/sparc64/kernel/isa.c | 8 | ||||
-rw-r--r-- | arch/sparc64/kernel/of_device.c | 2 |
3 files changed, 9 insertions, 9 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; |
diff --git a/arch/sparc64/kernel/isa.c b/arch/sparc64/kernel/isa.c index 0f3aec72ef5f..f028e68b23f2 100644 --- a/arch/sparc64/kernel/isa.c +++ b/arch/sparc64/kernel/isa.c | |||
@@ -115,12 +115,12 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br) | |||
115 | isa_dev->ofdev.node = dp; | 115 | isa_dev->ofdev.node = dp; |
116 | isa_dev->ofdev.dev.parent = &isa_br->ofdev.dev; | 116 | isa_dev->ofdev.dev.parent = &isa_br->ofdev.dev; |
117 | isa_dev->ofdev.dev.bus = &isa_bus_type; | 117 | isa_dev->ofdev.dev.bus = &isa_bus_type; |
118 | strcpy(isa_dev->ofdev.dev.bus_id, dp->path_component_name); | 118 | sprintf(isa_dev->ofdev.dev.bus_id, "isa[%08x]", dp->node); |
119 | 119 | ||
120 | /* Register with core */ | 120 | /* Register with core */ |
121 | if (of_device_register(&isa_dev->ofdev) != 0) { | 121 | if (of_device_register(&isa_dev->ofdev) != 0) { |
122 | printk(KERN_DEBUG "isa: device registration error for %s!\n", | 122 | printk(KERN_DEBUG "isa: device registration error for %s!\n", |
123 | isa_dev->ofdev.dev.bus_id); | 123 | dp->path_component_name); |
124 | kfree(isa_dev); | 124 | kfree(isa_dev); |
125 | goto next_sibling; | 125 | goto next_sibling; |
126 | } | 126 | } |
@@ -191,12 +191,12 @@ void __init isa_init(void) | |||
191 | isa_br->ofdev.node = dp; | 191 | isa_br->ofdev.node = dp; |
192 | isa_br->ofdev.dev.parent = &pdev->dev; | 192 | isa_br->ofdev.dev.parent = &pdev->dev; |
193 | isa_br->ofdev.dev.bus = &isa_bus_type; | 193 | isa_br->ofdev.dev.bus = &isa_bus_type; |
194 | strcpy(isa_br->ofdev.dev.bus_id, dp->path_component_name); | 194 | sprintf(isa_br->ofdev.dev.bus_id, "isa%d", index); |
195 | 195 | ||
196 | /* Register with core */ | 196 | /* Register with core */ |
197 | if (of_device_register(&isa_br->ofdev) != 0) { | 197 | if (of_device_register(&isa_br->ofdev) != 0) { |
198 | printk(KERN_DEBUG "isa: device registration error for %s!\n", | 198 | printk(KERN_DEBUG "isa: device registration error for %s!\n", |
199 | isa_br->ofdev.dev.bus_id); | 199 | dp->path_component_name); |
200 | kfree(isa_br); | 200 | kfree(isa_br); |
201 | return; | 201 | return; |
202 | } | 202 | } |
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c index 983ca5f485cf..8cc14fc6b6f1 100644 --- a/arch/sparc64/kernel/of_device.c +++ b/arch/sparc64/kernel/of_device.c | |||
@@ -861,7 +861,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp, | |||
861 | if (!parent) | 861 | if (!parent) |
862 | strcpy(op->dev.bus_id, "root"); | 862 | strcpy(op->dev.bus_id, "root"); |
863 | else | 863 | else |
864 | sprintf(op->dev.bus_id, "%s@%08x", dp->name, dp->node); | 864 | sprintf(op->dev.bus_id, "%08x", dp->node); |
865 | 865 | ||
866 | if (of_device_register(op)) { | 866 | if (of_device_register(op)) { |
867 | printk("%s: Could not register of device.\n", | 867 | printk("%s: Could not register of device.\n", |