ethtool: Allocate register dump buffer with vmalloc()
authorBen Hutchings <bhutchings@solarflare.com>
Mon, 20 Sep 2010 08:42:17 +0000 (08:42 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Sep 2010 21:57:59 +0000 (14:57 -0700)
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>
net/core/ethtool.c

index 91ffce20c36b2f4bf4c87f95ce6fc6c528a8cb46..dae2fd053c2b3c51a8fed31c380e93034bcf04b7 100644 (file)
@@ -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;
 
@@ -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;
 }