aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2013-09-19 12:01:52 -0400
committerGrant Likely <grant.likely@linaro.org>2013-10-15 15:09:19 -0400
commit8804827b305dbc1c6e24f2b36f1df4a9856b80e8 (patch)
tree9410216049081192e8b903e75454ffaf892639d3 /drivers/of
parentf3cea45a77c8ebdb7efad100e576eb6cb401bf25 (diff)
of: Fix dereferencing node name in debug output to be safe
Several locations in the of_address and of_irq code dereference the full_name parameter from a device_node pointer without checking if the pointer is valid. This patch switches to use of_node_full_name() which always checks the pointer. Signed-off-by: Grant Likely <grant.likely@linaro.org>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/address.c6
-rw-r--r--drivers/of/irq.c8
2 files changed, 7 insertions, 7 deletions
diff --git a/drivers/of/address.c b/drivers/of/address.c
index b55c21890760..71180b91bfbe 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -489,7 +489,7 @@ static u64 __of_translate_address(struct device_node *dev,
489 int na, ns, pna, pns; 489 int na, ns, pna, pns;
490 u64 result = OF_BAD_ADDR; 490 u64 result = OF_BAD_ADDR;
491 491
492 pr_debug("OF: ** translation for device %s **\n", dev->full_name); 492 pr_debug("OF: ** translation for device %s **\n", of_node_full_name(dev));
493 493
494 /* Increase refcount at current level */ 494 /* Increase refcount at current level */
495 of_node_get(dev); 495 of_node_get(dev);
@@ -504,13 +504,13 @@ static u64 __of_translate_address(struct device_node *dev,
504 bus->count_cells(dev, &na, &ns); 504 bus->count_cells(dev, &na, &ns);
505 if (!OF_CHECK_COUNTS(na, ns)) { 505 if (!OF_CHECK_COUNTS(na, ns)) {
506 printk(KERN_ERR "prom_parse: Bad cell count for %s\n", 506 printk(KERN_ERR "prom_parse: Bad cell count for %s\n",
507 dev->full_name); 507 of_node_full_name(dev));
508 goto bail; 508 goto bail;
509 } 509 }
510 memcpy(addr, in_addr, na * 4); 510 memcpy(addr, in_addr, na * 4);
511 511
512 pr_debug("OF: bus is %s (na=%d, ns=%d) on %s\n", 512 pr_debug("OF: bus is %s (na=%d, ns=%d) on %s\n",
513 bus->name, na, ns, parent->full_name); 513 bus->name, na, ns, of_node_full_name(parent));
514 of_dump_addr("OF: translating address:", addr, na); 514 of_dump_addr("OF: translating address:", addr, na);
515 515
516 /* Translate */ 516 /* Translate */
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 1752988d6aa8..f5fa5d84aa06 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -102,7 +102,7 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
102 int imaplen, match, i; 102 int imaplen, match, i;
103 103
104 pr_debug("of_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n", 104 pr_debug("of_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n",
105 parent->full_name, be32_to_cpup(intspec), 105 of_node_full_name(parent), be32_to_cpup(intspec),
106 be32_to_cpup(intspec + 1), ointsize); 106 be32_to_cpup(intspec + 1), ointsize);
107 107
108 ipar = of_node_get(parent); 108 ipar = of_node_get(parent);
@@ -126,7 +126,7 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
126 goto fail; 126 goto fail;
127 } 127 }
128 128
129 pr_debug("of_irq_map_raw: ipar=%s, size=%d\n", ipar->full_name, intsize); 129 pr_debug("of_irq_map_raw: ipar=%s, size=%d\n", of_node_full_name(ipar), intsize);
130 130
131 if (ointsize != intsize) 131 if (ointsize != intsize)
132 return -EINVAL; 132 return -EINVAL;
@@ -287,7 +287,7 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq
287 u32 intsize, intlen; 287 u32 intsize, intlen;
288 int res = -EINVAL; 288 int res = -EINVAL;
289 289
290 pr_debug("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index); 290 pr_debug("of_irq_map_one: dev=%s, index=%d\n", of_node_full_name(device), index);
291 291
292 /* OldWorld mac stuff is "special", handle out of line */ 292 /* OldWorld mac stuff is "special", handle out of line */
293 if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC) 293 if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)
@@ -355,7 +355,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
355 355
356 r->start = r->end = irq; 356 r->start = r->end = irq;
357 r->flags = IORESOURCE_IRQ; 357 r->flags = IORESOURCE_IRQ;
358 r->name = name ? name : dev->full_name; 358 r->name = name ? name : of_node_full_name(dev);
359 } 359 }
360 360
361 return irq; 361 return irq;