[PATCH v2 0/4] net: Use strlcpy() for ethtool::get_strings

From: Florian Fainelli
Date: Fri Mar 02 2018 - 18:08:59 EST


Hi all,

After turning on KASAN on one of my systems, I started getting lots of out of
bounds errors while fetching a given port's statistics, and indeed using
memcpy() is unsafe for copying strings which have not been declared as an array
of ETH_GSTRING_LEN bytes, so let's use strlcpy() instead. This allows the best
of both worlds: we still keep the efficient memory usage of variably sized
strings, but we don't copy more than we need to.

Changes in v2:
- dropped the 3 other patches that were not necessary
- use strlcpy() instead of strncpy()

Florian Fainelli (4):
net: dsa: b53: Use strlcpy() for ethtool::get_strings
net: phy: marvell: Use strlcpy() for ethtool::get_strings
net: phy: micrel: Use strlcpy() for ethtool::get_strings
net: phy: broadcom: Use strlcpy() for ethtool::get_strings

drivers/net/dsa/b53/b53_common.c | 4 ++--
drivers/net/phy/bcm-phy-lib.c | 4 ++--
drivers/net/phy/marvell.c | 4 ++--
drivers/net/phy/micrel.c | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)

--
2.14.1