SANDBOX_PHY_REG_CNT is not an allowable index for the array
u16 reg[SANDBOX_PHY_REG_CNT].
Identified by cppcheck.
Fixes: b47edf8069cc ("test: dm_mdio: add a 2nd register to the emulated PHY")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
return -ENODEV;
if (devad != MDIO_DEVAD_NONE)
return -ENODEV;
return -ENODEV;
if (devad != MDIO_DEVAD_NONE)
return -ENODEV;
- if (reg < 0 || reg > SANDBOX_PHY_REG_CNT)
+ if (reg < 0 || reg >= SANDBOX_PHY_REG_CNT)
return -ENODEV;
return priv->reg[reg];
return -ENODEV;
return priv->reg[reg];
return -ENODEV;
if (devad != MDIO_DEVAD_NONE)
return -ENODEV;
return -ENODEV;
if (devad != MDIO_DEVAD_NONE)
return -ENODEV;
- if (reg < 0 || reg > SANDBOX_PHY_REG_CNT)
+ if (reg < 0 || reg >= SANDBOX_PHY_REG_CNT)
return -ENODEV;
priv->reg[reg] = val;
return -ENODEV;
priv->reg[reg] = val;