forked from Minki/linux
net: phy: mscc: initialize stats array
The memory allocated for the stats array may contain arbitrary data. Fixes:e4f9ba642f
("net: phy: mscc: add support for VSC8514 PHY.") Fixes:00d70d8e0e
("net: phy: mscc: add support for VSC8574 PHY") Fixes:a5afc16780
("net: phy: mscc: add support for VSC8584 PHY") Fixes:f76178dc52
("net: phy: mscc: add ethtool statistics counters") Signed-off-by: Andreas Schwab <schwab@suse.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c7fa7f567c
commit
f972037e71
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user