Skip to content

Commit 60d6e6f

Browse files
ffainellidavem330
authored andcommitted
net: bgmac: Fix endian access in bgmac_dma_tx_ring_free()
bgmac_dma_tx_ring_free() assigns the ctl1 word which is a litle endian 32-bit word without using proper accessors, fix this, and because a length cannot be negative, use unsigned int while at it. Fixes: 9cde945 ("bgmac: implement scatter/gather support") Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 16a1c06 commit 60d6e6f

File tree

1 file changed

+2
-1
lines changed
  • drivers/net/ethernet/broadcom

1 file changed

+2
-1
lines changed

drivers/net/ethernet/broadcom/bgmac.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,8 @@ static void bgmac_dma_tx_ring_free(struct bgmac *bgmac,
533533
int i;
534534

535535
for (i = 0; i < BGMAC_TX_RING_SLOTS; i++) {
536-
int len = dma_desc[i].ctl1 & BGMAC_DESC_CTL1_LEN;
536+
u32 ctl1 = le32_to_cpu(dma_desc[i].ctl1);
537+
unsigned int len = ctl1 & BGMAC_DESC_CTL1_LEN;
537538

538539
slot = &ring->slots[i];
539540
dev_kfree_skb(slot->skb);

0 commit comments

Comments
 (0)