Skip to content

Commit

Permalink
net: bgmac: Fix endian access in bgmac_dma_tx_ring_free()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ffainelli authored and davem330 committed Apr 2, 2018
1 parent 16a1c06 commit 60d6e6f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/broadcom/bgmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,8 @@ static void bgmac_dma_tx_ring_free(struct bgmac *bgmac,
int i;

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

slot = &ring->slots[i];
dev_kfree_skb(slot->skb);
Expand Down

0 comments on commit 60d6e6f

Please sign in to comment.