diff options
author | Maxime Chevallier <maxime.chevallier@bootlin.com> | 2019-06-06 10:42:56 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-06-06 19:38:42 +0200 |
commit | d37acd5aa99c57505b64913e0e2624ec3daed8c5 (patch) | |
tree | 4e9f453d5fc67784c8c4644da5523d388fa49011 /drivers/net | |
parent | net: rds: fix memory leak in rds_ib_flush_mr_pool (diff) | |
download | linux-d37acd5aa99c57505b64913e0e2624ec3daed8c5.tar.xz linux-d37acd5aa99c57505b64913e0e2624ec3daed8c5.zip |
net: mvpp2: Use strscpy to handle stat strings
Use a safe strscpy call to copy the ethtool stat strings into the
relevant buffers, instead of a memcpy that will be accessing
out-of-bound data.
Fixes: 118d6298f6f0 ("net: mvpp2: add ethtool GOP statistics")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 7a67e23a2c2b..d8e5241097a9 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -1304,8 +1304,8 @@ static void mvpp2_ethtool_get_strings(struct net_device *netdev, u32 sset, int i; for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_regs); i++) - memcpy(data + i * ETH_GSTRING_LEN, - &mvpp2_ethtool_regs[i].string, ETH_GSTRING_LEN); + strscpy(data + i * ETH_GSTRING_LEN, + mvpp2_ethtool_regs[i].string, ETH_GSTRING_LEN); } } |