From: David Miller Subject: Re: [PATCH v2 0/4] net: Use strlcpy() for ethtool::get_strings Date: Tue, 06 Mar 2018 11:13:35 -0500 (EST) Message-ID: <20180306.111335.666760211356084355.davem@davemloft.net> References: <20180302230839.31468-1-f.fainelli@gmail.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, david.laight@aculab.com, andrew@lunn.ch, vivien.didelot@savoirfairelinux.com, linux-kernel@vger.kernel.org, opendmb@gmail.com To: f.fainelli@gmail.com Return-path: In-Reply-To: <20180302230839.31468-1-f.fainelli@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org From: Florian Fainelli 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.