Re: [PATCH v2 0/4] net: Use strlcpy() for ethtool::get_strings
From: David Miller
Date: Tue Mar 06 2018 - 11:13:43 EST
From: Florian Fainelli <f.fainelli@xxxxxxxxx>
Date: Fri, 2 Mar 2018 15:08:35 -0800
> 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()
Series applied, thanks Florian.