From: Anton Vorontsov <avorontsov@mvista.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org,
Sandeep Gopalpet <Sandeep.Kumar@freescale.com>,
linuxppc-dev@ozlabs.org
Subject: [PATCH 2/2] gianfar: Fix potential oops during OF address translation
Date: Fri, 23 Apr 2010 21:12:44 +0400 [thread overview]
Message-ID: <20100423171244.GB2140@oksana.dev.rtsoft.ru> (raw)
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>
---
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 080d1ce..df49af3 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -549,12 +549,8 @@ static int gfar_parse_group(struct device_node *np,
struct gfar_private *priv, const char *model)
{
u32 *queue_mask;
- u64 addr, size;
-
- addr = of_translate_address(np,
- of_get_address(np, 0, &size, NULL));
- priv->gfargrp[priv->num_grps].regs = ioremap(addr, size);
+ priv->gfargrp[priv->num_grps].regs = of_iomap(np, 0);
if (!priv->gfargrp[priv->num_grps].regs)
return -ENOMEM;
--
1.7.0.5
next reply other threads:[~2010-04-23 17:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-23 17:12 Anton Vorontsov [this message]
2010-04-23 23:20 ` [PATCH 2/2] gianfar: Fix potential oops during OF address translation David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100423171244.GB2140@oksana.dev.rtsoft.ru \
--to=avorontsov@mvista.com \
--cc=Sandeep.Kumar@freescale.com \
--cc=davem@davemloft.net \
--cc=linuxppc-dev@ozlabs.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).