Skip to contentSkip to conversation

PPC temac phy probe unsigned int underflow fix.

PATCH New hpeyerl 2 participants 2 messages Aug 2, 2012 – Sep 2, 2012

lore
Share & tools
lore

hpeyerl

author
#0 lore raw

PATCH 1/1 PPC temac phy probe unsigned int underflow fix.

Signed-off-by hpeyerl at beer.org (Herb Peyerl)

Apologies for the non-git formatted drive-by patch.

If, during phy detection, your phy does not respond, then ll_temac_phy_addr() will underflow due to the declaration of local variable 'phy' as an unsigned int.

--- drivers/net/xilinx_ll_temac_mdio.c 11 Jul 2012 00:52:14 -0000 1.1.1.1
+++ drivers/net/xilinx_ll_temac_mdio.c 2 Aug 2012 16:23:48 -0000 @@ -137,7 +137,7 @@

  {
         struct temac_reg *regs = (struct temac_reg *)bus->priv;
         unsigned short val;

- unsigned int phy;
+ int phy;

for (phy = PHY_MAX_ADDR; phy >= 0; phy--) {
val = ll_temac_local_mdio_read(regs, phy, 0,
PHY_DETECT_REG);

#1 lore raw

PATCH 1/1 PPC temac phy probe unsigned int underflow fix.

Dear hpeyerl,

Quoted 21 lines · In message <[email protected]> you wrote:
Signed-off-by hpeyerl at beer.org (Herb Peyerl)

Apologies for the non-git formatted drive-by patch.

If, during phy detection, your phy does not respond, then ll_temac_phy_addr() will underflow due to the declaration of local variable 'phy' as an unsigned int.

--- drivers/net/xilinx_ll_temac_mdio.c 11 Jul 2012 00:52:14 -0000 1.1.1.1
+++ drivers/net/xilinx_ll_temac_mdio.c 2 Aug 2012 16:23:48 -0000

(quoted diff) +1 -1
@@ -137,7 +137,7 @@
  {
         struct temac_reg *regs = (struct temac_reg *)bus->priv;
         unsigned short val;
-       unsigned int phy;
+       int phy;
 
         for (phy = PHY_MAX_ADDR; phy >= 0; phy--) {
                 val = ll_temac_local_mdio_read(regs, phy, 0, 
Quoted 1 line

PHY_DETECT_REG);

Sorry, this does not apply as your patch is white-space mangled (TABs have been replaced by spaces, long lines wrapped).

Pleas resubmit after fixing you mailer configuration (or rather use git send-email instead).

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Include the success of others in your dreams for your own success.