From: Dave Jones Date: Mon, 22 Jun 2009 05:42:30 +0000 (-0700) Subject: via-velocity: Fix velocity driver unmapping incorrect size. X-Git-Tag: v2.6.30.1~90 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e692eaafaf5d7c8aeef219959acaaa55702f5ebe;p=karo-tx-linux.git via-velocity: Fix velocity driver unmapping incorrect size. [ Upstream commit f6b24caaf933a466397915a08e30e885a32f905a ] When a packet is greater than ETH_ZLEN, we end up assigning the boolean result of a comparison to the size we unmap. Signed-off-by: Dave Jones Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 754a4b182c1d..b2816ad6f2a2 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c @@ -1845,7 +1845,7 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, struct velocity_td_ */ if (tdinfo->skb_dma) { - pktlen = (skb->len > ETH_ZLEN ? : ETH_ZLEN); + pktlen = max_t(unsigned int, skb->len, ETH_ZLEN); for (i = 0; i < tdinfo->nskb_dma; i++) { #ifdef VELOCITY_ZERO_COPY_SUPPORT pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], le16_to_cpu(td->tdesc1.len), PCI_DMA_TODEVICE);