net: ethernet: mediatek: avoid potential invalid memory access