diff options
author | Anton Vorontsov <avorontsov@mvista.com> | 2010-04-23 03:12:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-23 19:20:25 -0400 |
commit | 7ce97d4f78b62e3af24cdd4df953d777e7efb2f6 (patch) | |
tree | 00d6462333163e933875480371470975b45ad2e6 /drivers/net/gianfar.c | |
parent | 3b1fd3e55a39824e68bc8dd055d14892476e3671 (diff) |
gianfar: Fix potential oops during OF address translation
gianfar driver may pass NULL pointer to the of_translate_address(),
which may lead to a kernel oops. Fix this by using of_iomap(), which
is also much simpler and shorter.
Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/gianfar.c')
-rw-r--r-- | drivers/net/gianfar.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 080d1cea5b26..df49af382159 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -549,12 +549,8 @@ static int gfar_parse_group(struct device_node *np, | |||
549 | struct gfar_private *priv, const char *model) | 549 | struct gfar_private *priv, const char *model) |
550 | { | 550 | { |
551 | u32 *queue_mask; | 551 | u32 *queue_mask; |
552 | u64 addr, size; | ||
553 | |||
554 | addr = of_translate_address(np, | ||
555 | of_get_address(np, 0, &size, NULL)); | ||
556 | priv->gfargrp[priv->num_grps].regs = ioremap(addr, size); | ||
557 | 552 | ||
553 | priv->gfargrp[priv->num_grps].regs = of_iomap(np, 0); | ||
558 | if (!priv->gfargrp[priv->num_grps].regs) | 554 | if (!priv->gfargrp[priv->num_grps].regs) |
559 | return -ENOMEM; | 555 | return -ENOMEM; |
560 | 556 | ||