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

Commit d37acd5a authored by Maxime Chevallier's avatar Maxime Chevallier Committed by David S. Miller
Browse files

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: 118d6298 ("net: mvpp2: add ethtool GOP statistics")
Signed-off-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 85cb9287
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);
	}
}