diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2018-04-01 10:26:30 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-01 22:20:48 -0400 |
commit | 60d6e6f0b9e422dd01aeda39257ee0428e5e2a3f (patch) | |
tree | 809fe704a4c24a4383ce887c0c668d33b7a5851a /drivers | |
parent | 16a1c0646e55c3345bce8e4edfc06ad119d27c04 (diff) |
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: 9cde94506eac ("bgmac: implement scatter/gather support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/broadcom/bgmac.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index 2326cc219c46..e6ea8e61f96d 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c @@ -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); |