Skip to content

Commit

Permalink
ethtool: Allocate register dump buffer with vmalloc()
Browse files Browse the repository at this point in the history
Some NICs have huge register files which exceed the maximum heap
allocation size.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Sep 21, 2010
1 parent 6099e3d commit a77f5db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)
if (regs.len > reglen)
regs.len = reglen;

regbuf = kmalloc(reglen, GFP_USER);
regbuf = vmalloc(reglen);
if (!regbuf)
return -ENOMEM;

Expand All @@ -830,7 +830,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)
ret = 0;

out:
kfree(regbuf);
vfree(regbuf);
return ret;
}

Expand Down

0 comments on commit a77f5db

Please sign in to comment.