Netdev List
 help / color / mirror / Atom feed
* Subject: [RFC][PATCH 02/11] via-velocity breakage on big-endian
@ 2018-01-05 19:31 Al Viro
  0 siblings, 0 replies; only message in thread
From: Al Viro @ 2018-01-05 19:31 UTC (permalink / raw)
  To: netdev; +Cc: romieu, Romieu, Francois


Convert to host-endian first, *then* use max_t.  Doing it the
other way around is broken on big-endian hosts and this chipset
does occur on pcie cards - it's not always embedded into
motherboard of a little-endian system.

Fixes: c79992fddee2 (via-velocity: Re-enable transmit scatter-gather support)
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 drivers/net/ethernet/via/via-velocity.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c
index 7b6dc6e8d6c0..4156c33d954e 100644
--- a/drivers/net/ethernet/via/via-velocity.c
+++ b/drivers/net/ethernet/via/via-velocity.c
@@ -1733,12 +1733,13 @@ static void velocity_free_tx_buf(struct velocity_info *vptr,
 		size_t pktlen = max_t(size_t, skb->len, ETH_ZLEN);
 
 		/* For scatter-gather */
-		if (skb_shinfo(skb)->nr_frags > 0)
-			pktlen = max_t(size_t, pktlen,
-				       td->td_buf[i].size & ~TD_QUEUE);
+		if (skb_shinfo(skb)->nr_frags > 0) {
+			__le16 sz = td->td_buf[i].size & ~TD_QUEUE;
+			pktlen = max_t(size_t, pktlen, le16_to_cpu(sz));
+		}
 
 		dma_unmap_single(vptr->dev, tdinfo->skb_dma[i],
-				 le16_to_cpu(pktlen), DMA_TO_DEVICE);
+				 pktlen, DMA_TO_DEVICE);
 	}
 	dev_kfree_skb_irq(skb);
 	tdinfo->skb = NULL;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-01-05 19:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-05 19:31 Subject: [RFC][PATCH 02/11] via-velocity breakage on big-endian Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox