aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--arch/sparc/kernel/ebus.c8
-rw-r--r--arch/sparc/kernel/of_device.c2
-rw-r--r--arch/sparc64/kernel/ebus.c8
-rw-r--r--arch/sparc64/kernel/isa.c8
-rw-r--r--arch/sparc64/kernel/of_device.c2
-rw-r--r--drivers/sbus/sbus.c4
6 files changed, 16 insertions, 16 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;
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index 74bef2a2d37f..46200c43ffb1 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -651,7 +651,7 @@ build_resources:
651 if (!parent) 651 if (!parent)
652 strcpy(op->dev.bus_id, "root"); 652 strcpy(op->dev.bus_id, "root");
653 else 653 else
654 strcpy(op->dev.bus_id, dp->path_component_name); 654 sprintf(op->dev.bus_id, "%08x", dp->node);
655 655
656 if (of_device_register(op)) { 656 if (of_device_register(op)) {
657 printk("%s: Could not register of device.\n", 657 printk("%s: Could not register of device.\n",
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",
diff --git a/drivers/sbus/sbus.c b/drivers/sbus/sbus.c
index 935952ef88f1..98fcbb3d5560 100644
--- a/drivers/sbus/sbus.c
+++ b/drivers/sbus/sbus.c
@@ -61,11 +61,11 @@ static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sde
61 else 61 else
62 sdev->ofdev.dev.parent = &sdev->bus->ofdev.dev; 62 sdev->ofdev.dev.parent = &sdev->bus->ofdev.dev;
63 sdev->ofdev.dev.bus = &sbus_bus_type; 63 sdev->ofdev.dev.bus = &sbus_bus_type;
64 strcpy(sdev->ofdev.dev.bus_id, dp->path_component_name); 64 sprintf(sdev->ofdev.dev.bus_id, "sbus[%08x]", dp->node);
65 65
66 if (of_device_register(&sdev->ofdev) != 0) 66 if (of_device_register(&sdev->ofdev) != 0)
67 printk(KERN_DEBUG "sbus: device registration error for %s!\n", 67 printk(KERN_DEBUG "sbus: device registration error for %s!\n",
68 sdev->ofdev.dev.bus_id); 68 dp->path_component_name);
69} 69}
70 70
71static void __init sbus_bus_ranges_init(struct device_node *dp, struct sbus_bus *sbus) 71static void __init sbus_bus_ranges_init(struct device_node *dp, struct sbus_bus *sbus)