From: Andrew Lunn Subject: Re: [PATCH net 4/4] net: dsa: mv88e6xxx: Utilize strncpy() for ethtool::get_strings Date: Fri, 2 Mar 2018 04:08:04 +0100 Message-ID: <20180302030804.GB12656@lunn.ch> References: <20180302002529.15226-1-f.fainelli@gmail.com> <20180302002529.15226-5-f.fainelli@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, Vivien Didelot , Woojung Huh , Microchip Linux Driver Support , open list To: Florian Fainelli Return-path: Content-Disposition: inline In-Reply-To: <20180302002529.15226-5-f.fainelli@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Thu, Mar 01, 2018 at 04:25:29PM -0800, Florian Fainelli wrote: > Do not use memcpy() which is not safe, but instead use strncpy() which > will make sure that the string is NUL terminated (in the Linux > implementation) if the string is smaller than the length specified. This > fixes KASAN out of bounds warnings while fetching port statistics. > > Fixes: f5e2ed022dff ("dsa: mv88e6xxx: Add Second back of statistics") I'm sure it goes back much further than that. > Signed-off-by: Florian Fainelli Reviewed-by: Andrew Lunn Andrew