Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f972037e authored by Andreas Schwab's avatar Andreas Schwab Committed by David S. Miller
Browse files

net: phy: mscc: initialize stats array



The memory allocated for the stats array may contain arbitrary data.

Fixes: e4f9ba64 ("net: phy: mscc: add support for VSC8514 PHY.")
Fixes: 00d70d8e ("net: phy: mscc: add support for VSC8574 PHY")
Fixes: a5afc167 ("net: phy: mscc: add support for VSC8584 PHY")
Fixes: f76178dc ("net: phy: mscc: add ethtool statistics counters")
Signed-off-by: default avatarAndreas Schwab <schwab@suse.de>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c7fa7f56
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -2226,7 +2226,7 @@ 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,
	vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats,
				      sizeof(u64), GFP_KERNEL);
	if (!vsc8531->stats)
		return -ENOMEM;
@@ -2251,7 +2251,7 @@ 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,
	vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats,
				      sizeof(u64), GFP_KERNEL);
	if (!vsc8531->stats)
		return -ENOMEM;
@@ -2281,7 +2281,7 @@ 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,
	vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats,
				      sizeof(u64), GFP_KERNEL);
	if (!vsc8531->stats)
		return -ENOMEM;
@@ -2311,7 +2311,7 @@ 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,
	vsc8531->stats = devm_kcalloc(&phydev->mdio.dev, vsc8531->nstats,
				      sizeof(u64), GFP_KERNEL);
	if (!vsc8531->stats)
		return -ENOMEM;