Skip to content

Commit

Permalink
gianfar: Fix potential oops during OF address translation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Anton Vorontsov authored and David S. Miller committed Apr 23, 2010
1 parent 3b1fd3e commit 7ce97d4
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions drivers/net/gianfar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 7ce97d4

Please sign in to comment.