[patch 022/108] via-velocity: Fix velocity driver unmapping incorrect size.

From: Greg KH
Date: Tue Jun 30 2009 - 20:53:00 EST


2.6.30-stable review patch. If anyone has any objections, please let us know.

------------------

From: Dave Jones <davej@xxxxxxxxxx>

[ 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 <davej@xxxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/net/via-velocity.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1845,7 +1845,7 @@ static void velocity_free_tx_buf(struct
*/
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);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/