Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f83284fe authored by roel kluin's avatar roel kluin Committed by David S. Miller
Browse files

fealnx: Write outside array bounds



phy_idx is checked to be < 4, but np->phys[] is 2 elements long

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ffafa60d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -584,7 +584,8 @@ static int __devinit fealnx_init_one(struct pci_dev *pdev,
	if (np->flags == HAS_MII_XCVR) {
		int phy, phy_idx = 0;

		for (phy = 1; phy < 32 && phy_idx < 4; phy++) {
		for (phy = 1; phy < 32 && phy_idx < ARRAY_SIZE(np->phys);
			       phy++) {
			int mii_status = mdio_read(dev, phy, 1);

			if (mii_status != 0xffff && mii_status != 0x0000) {