net: phy: mscc: initialize stats array
Subsystems (3)
PATCH 1/1 net: phy: mscc: initialize stats array
The memory allocated for the stats array may contain arbitrary data.
Signed-off-by Andreas Schwab <[email protected]>
--- drivers/net/phy/mscc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/phy/mscc.c +8 -8
@@ -2226,8 +2226,8 @@ static int vsc8514_probe(struct phy_device *phydev) vsc8531->supp_led_modes =VSC85XX_SUPP_LED_MODES ; vsc8531->hw_stats = vsc85xx_hw_stats; vsc8531->nstats =ARRAY_SIZE (vsc85xx_hw_stats); - vsc8531->stats =devm_kmalloc_array (&phydev->mdio.dev, vsc8531->nstats, -sizeof (u64),GFP_KERNEL ); + vsc8531->stats =devm_kcalloc (&phydev->mdio.dev, vsc8531->nstats, +sizeof (u64),GFP_KERNEL );if (!vsc8531->stats)return -ENOMEM ;
@@ -2251,8 +2251,8 @@ static int vsc8574_probe(struct phy_device *phydev) vsc8531->supp_led_modes =VSC8584_SUPP_LED_MODES ; vsc8531->hw_stats = vsc8584_hw_stats; vsc8531->nstats =ARRAY_SIZE (vsc8584_hw_stats); - vsc8531->stats =devm_kmalloc_array (&phydev->mdio.dev, vsc8531->nstats, -sizeof (u64),GFP_KERNEL ); + vsc8531->stats =devm_kcalloc (&phydev->mdio.dev, vsc8531->nstats, +sizeof (u64),GFP_KERNEL );if (!vsc8531->stats)return -ENOMEM ;
@@ -2281,8 +2281,8 @@ static int vsc8584_probe(struct phy_device *phydev) vsc8531->supp_led_modes =VSC8584_SUPP_LED_MODES ; vsc8531->hw_stats = vsc8584_hw_stats; vsc8531->nstats =ARRAY_SIZE (vsc8584_hw_stats); - vsc8531->stats =devm_kmalloc_array (&phydev->mdio.dev, vsc8531->nstats, -sizeof (u64),GFP_KERNEL ); + vsc8531->stats =devm_kcalloc (&phydev->mdio.dev, vsc8531->nstats, +sizeof (u64),GFP_KERNEL );if (!vsc8531->stats)return -ENOMEM ;
@@ -2311,8 +2311,8 @@ static int vsc85xx_probe(struct phy_device *phydev) vsc8531->supp_led_modes =VSC85XX_SUPP_LED_MODES ; vsc8531->hw_stats = vsc85xx_hw_stats; vsc8531->nstats =ARRAY_SIZE (vsc85xx_hw_stats); - vsc8531->stats =devm_kmalloc_array (&phydev->mdio.dev, vsc8531->nstats, -sizeof (u64),GFP_KERNEL ); + vsc8531->stats =devm_kcalloc (&phydev->mdio.dev, vsc8531->nstats, +sizeof (u64),GFP_KERNEL );if (!vsc8531->stats)return -ENOMEM ;
Signature · 7 lines
2.22.0 -- Andreas Schwab, SUSE Labs, [email protected] GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
Quoted 3 lines · Andreas Schwab
The memory allocated for the stats array may contain arbitrary data.
Signed-off-by Andreas Schwab <[email protected]>
Reviewed-by Andrew Lunn <[email protected]>
Fixes e4f9ba642f0b ("net: phy: mscc: add support for VSC8514 PHY.")
Fixes 00d70d8e0e78 ("net: phy: mscc: add support for VSC8574 PHY")
Fixes a5afc1678044 ("net: phy: mscc: add support for VSC8584 PHY")
Fixes f76178dc5218 ("net: phy: mscc: add ethtool statistics counters")
Andrew
David Miller
maintainerFrom: Andreas Schwab <[email protected]>
Date: Wed, 24 Jul 2019 17:32:57 +0200
Quoted 3 lines
The memory allocated for the stats array may contain arbitrary data.
Signed-off-by Andreas Schwab <[email protected]>
Applied and queued up for -stable.