mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
net: mvpp2: Use strscpy to handle stat strings
[ Upstream commitd37acd5aa9] 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:118d6298f6("net: mvpp2: add ethtool GOP statistics") Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d305d61fcf
commit
c6a020e011
@@ -1310,8 +1310,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user