usb: eth: fix memalign() parameter order
authorStephen Warren <swarren@nvidia.com>
Fri, 12 Feb 2016 20:56:01 +0000 (13:56 -0700)
committerMarek Vasut <marex@denx.de>
Wed, 24 Feb 2016 18:12:33 +0000 (19:12 +0100)
The alignment and size were swapped, leading to malloc heap corruption.

On my system, this sometimes caused U-Boot to crash during or after
certain USB Ethernet operations.

Fixes: c8c2797c3810 ("dm: usb: eth: Support driver model with USB Ethernet")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
drivers/usb/eth/usb_ether.c

index b9c9a8402e3986bce3506f2fd9937f70c28e7fcf..36734e2e51b3f82b1e3daafbc443c73505284e99 100644 (file)
@@ -73,7 +73,7 @@ int usb_ether_register(struct udevice *dev, struct ueth_data *ueth, int rxsize)
        }
 
        ueth->rxsize = rxsize;
-       ueth->rxbuf = memalign(rxsize, ARCH_DMA_MINALIGN);
+       ueth->rxbuf = memalign(ARCH_DMA_MINALIGN, rxsize);
        if (!ueth->rxbuf)
                return -ENOMEM;