net: stmmac: dwmac4: mac address array boudary violation issue
authorBiao Huang <biao.huang@mediatek.com>
Tue, 9 Jul 2019 02:36:22 +0000 (10:36 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 9 Jul 2019 21:17:59 +0000 (14:17 -0700)
The mac address array size is GMAC_MAX_PERFECT_ADDRESSES,
so the 'reg' should be less than it, or will affect other registers.

Signed-off-by: Biao Huang <biao.huang@mediatek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c

index 8d9f6cd..776077e 100644 (file)
@@ -454,7 +454,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw,
                        reg++;
                }
 
-               while (reg <= GMAC_MAX_PERFECT_ADDRESSES) {
+               while (reg < GMAC_MAX_PERFECT_ADDRESSES) {
                        writel(0, ioaddr + GMAC_ADDR_HIGH(reg));
                        writel(0, ioaddr + GMAC_ADDR_LOW(reg));
                        reg++;