* [PATCH] tulip: Read buffer overflow
@ 2009-08-02 6:26 Roel Kluin
2009-08-02 19:31 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Roel Kluin @ 2009-08-02 6:26 UTC (permalink / raw)
To: grundler, kyle, netdev, Andrew Morton
Check whether index is within bounds before testing the element.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index eb72d2e..acfdccd 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -5059,7 +5059,7 @@ mii_get_phy(struct net_device *dev)
if ((id == 0) || (id == 65535)) continue; /* Valid ID? */
for (j=0; j<limit; j++) { /* Search PHY table */
if (id != phy_info[j].id) continue; /* ID match? */
- for (k=0; lp->phy[k].id && (k < DE4X5_MAX_PHY); k++);
+ for (k=0; k < DE4X5_MAX_PHY && lp->phy[k].id; k++);
if (k < DE4X5_MAX_PHY) {
memcpy((char *)&lp->phy[k],
(char *)&phy_info[j], sizeof(struct phy_table));
@@ -5072,7 +5072,7 @@ mii_get_phy(struct net_device *dev)
break;
}
if ((j == limit) && (i < DE4X5_MAX_MII)) {
- for (k=0; lp->phy[k].id && (k < DE4X5_MAX_PHY); k++);
+ for (k=0; k < DE4X5_MAX_PHY && lp->phy[k].id; k++);
lp->phy[k].addr = i;
lp->phy[k].id = id;
lp->phy[k].spd.reg = GENERIC_REG; /* ANLPA register */
@@ -5091,7 +5091,7 @@ mii_get_phy(struct net_device *dev)
purgatory:
lp->active = 0;
if (lp->phy[0].id) { /* Reset the PHY devices */
- for (k=0; lp->phy[k].id && (k < DE4X5_MAX_PHY); k++) { /*For each PHY*/
+ for (k=0; k < DE4X5_MAX_PHY && lp->phy[k].id; k++) { /*For each PHY*/
mii_wr(MII_CR_RST, MII_CR, lp->phy[k].addr, DE4X5_MII);
while (mii_rd(MII_CR, lp->phy[k].addr, DE4X5_MII) & MII_CR_RST);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tulip: Read buffer overflow
2009-08-02 6:26 [PATCH] tulip: Read buffer overflow Roel Kluin
@ 2009-08-02 19:31 ` David Miller
2009-08-02 19:45 ` Kyle McMartin
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2009-08-02 19:31 UTC (permalink / raw)
To: roel.kluin; +Cc: grundler, kyle, netdev, akpm
From: Roel Kluin <roel.kluin@gmail.com>
Date: Sun, 02 Aug 2009 08:26:52 +0200
> Check whether index is within bounds before testing the element.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tulip: Read buffer overflow
2009-08-02 19:31 ` David Miller
@ 2009-08-02 19:45 ` Kyle McMartin
0 siblings, 0 replies; 3+ messages in thread
From: Kyle McMartin @ 2009-08-02 19:45 UTC (permalink / raw)
To: David Miller; +Cc: roel.kluin, grundler, kyle, netdev, akpm
On Sun, Aug 02, 2009 at 12:31:41PM -0700, David Miller wrote:
> From: Roel Kluin <roel.kluin@gmail.com>
> Date: Sun, 02 Aug 2009 08:26:52 +0200
>
> > Check whether index is within bounds before testing the element.
> >
> > Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>
> Applied.
>
Thanks Dave, Roel.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-08-02 19:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-02 6:26 [PATCH] tulip: Read buffer overflow Roel Kluin
2009-08-02 19:31 ` David Miller
2009-08-02 19:45 ` Kyle McMartin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).