fealnx: Write outside array bounds

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, July 27, 2009 - 3:59 pm

Gitweb:     http://git.kernel.org/linus/f83284fe209b1d143244bf462abf1b414eb7b62a
Commit:     f83284fe209b1d143244bf462abf1b414eb7b62a
Parent:     ffafa60d496f80c250f2ae0340ae94434c0b0b4d
Author:     roel kluin <roel.kluin@gmail.com>
AuthorDate: Sat Jul 25 07:41:12 2009 +0000
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Sun Jul 26 18:50:37 2009 -0700

    fealnx: Write outside array bounds
    
    phy_idx is checked to be < 4, but np->phys[] is 2 elements long
    
    Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/fealnx.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c
index 891be28..ee51557 100644
--- a/drivers/net/fealnx.c
+++ b/drivers/net/fealnx.c
@@ -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) {
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
fealnx: Write outside array bounds, Linux Kernel Mailing ..., (Mon Jul 27, 3:59 pm)