Re: [PATCH] net: phy: mscc: initialize stats array

2019-07-24 Thread David Miller
From: Andreas Schwab 
Date: Wed, 24 Jul 2019 17:32:57 +0200

> The memory allocated for the stats array may contain arbitrary data.
> 
> Signed-off-by: Andreas Schwab 

Applied and queued up for -stable.


Re: [PATCH] net: phy: mscc: initialize stats array

2019-07-24 Thread Andrew Lunn
On Wed, Jul 24, 2019 at 05:32:57PM +0200, Andreas Schwab wrote:
> The memory allocated for the stats array may contain arbitrary data.
> 
> Signed-off-by: Andreas Schwab 

Reviewed-by: Andrew Lunn 
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


[PATCH] net: phy: mscc: initialize stats array

2019-07-24 Thread Andreas Schwab
The memory allocated for the stats array may contain arbitrary data.

Signed-off-by: Andreas Schwab 
---
 drivers/net/phy/mscc.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
index 28676af97b42..645d354ffb48 100644
--- a/drivers/net/phy/mscc.c
+++ b/drivers/net/phy/mscc.c
@@ -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(>mdio.dev, vsc8531->nstats,
-   sizeof(u64), GFP_KERNEL);
+   vsc8531->stats = devm_kcalloc(>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(>mdio.dev, vsc8531->nstats,
-   sizeof(u64), GFP_KERNEL);
+   vsc8531->stats = devm_kcalloc(>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(>mdio.dev, vsc8531->nstats,
-   sizeof(u64), GFP_KERNEL);
+   vsc8531->stats = devm_kcalloc(>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(>mdio.dev, vsc8531->nstats,
-   sizeof(u64), GFP_KERNEL);
+   vsc8531->stats = devm_kcalloc(>mdio.dev, vsc8531->nstats,
+ sizeof(u64), GFP_KERNEL);
if (!vsc8531->stats)
return -ENOMEM;
 
-- 
2.22.0


-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."