Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7971663ybi; Thu, 6 Jun 2019 04:43:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJtIvVB4YZ22ub+ZWh3uk4TgdG9zMTG8A7zWovBNAwaYysoJiOK1epv2kj9ESkss7OYnve X-Received: by 2002:a17:902:148:: with SMTP id 66mr46977757plb.143.1559821400537; Thu, 06 Jun 2019 04:43:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559821400; cv=none; d=google.com; s=arc-20160816; b=wVHiJAzoMieigLezlpgUOjFEI/xIICLaX7xlH8/an9hxxvc2fZ4E+ch4pjCqWXN+sk AS7wm+pgFpK5zbB+Ee65ITQf5CajEn1yN5ytHwCfRQiL+gOkeTVAAK+2bZ/xstbrFgOn jYsUvgW59N9RZ73R72ehifTWoOdRJh2dmnWEjRJVM1kgBhGtqqc3DgD4eYgn0bxcJOho zHA/1dnf89OMuyn/grS/w7+poO7cjeERIKFuoJ4LZYMsPNc+oCygFNyQtIgT0DpBDE2k I5lV5c2xA8wibgSetYLj4g+IOf779fz/iBiV+MUlnG1ySVHqkC5XMOy5/ok+E/12oj8I PX1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=cd1YTa+7/KTp0ckQPQWcAF33gagrNb9xsiFIgrIdoNY=; b=jAyZvXfac3U555f3F410ZY/B85IuYxYIT6aGlpkSHE3gAAxl1aTPZyiVjcguNDteYr ZPKhTbGlIukX1jwPBGjmJq/xU8Z5dXPDT4O5OYhEl4y+E2eIrKc0sFK0123y8m+YHkjg lHLKgrYcUNjyf+/ihMU5kYwuHb5jQ43zs9HTB4izVW37W21xCA25AtPGets5iZtOsYec fOViK41lqSuCmHya22L9Ldn8kkkGbm1QIhwOEeqrtt3FtRVMkbRSDDNs+rPGVWzl8hNU ZoJzsQyMz2Qid/x0ctM3aNV20uGTwsb29W+lWfZo6gYA3uD3uNR5bKSL4J7sQ6htVbGz jSVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11si1539524plr.323.2019.06.06.04.43.03; Thu, 06 Jun 2019 04:43:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727337AbfFFInT (ORCPT + 99 others); Thu, 6 Jun 2019 04:43:19 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:42945 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725782AbfFFInS (ORCPT ); Thu, 6 Jun 2019 04:43:18 -0400 X-Originating-IP: 90.88.144.139 Received: from mc-bl-xps13.lan (aaubervilliers-681-1-24-139.w90-88.abo.wanadoo.fr [90.88.144.139]) (Authenticated sender: maxime.chevallier@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 7888E40008; Thu, 6 Jun 2019 08:43:13 +0000 (UTC) From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Antoine Tenart , thomas.petazzoni@bootlin.com, gregory.clement@bootlin.com, miquel.raynal@bootlin.com, nadavh@marvell.com, stefanc@marvell.com, mw@semihalf.com Subject: [PATCH net] net: mvpp2: Use strscpy to handle stat strings Date: Thu, 6 Jun 2019 10:42:56 +0200 Message-Id: <20190606084256.3703-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: 118d6298f6f0 ("net: mvpp2: add ethtool GOP statistics") Signed-off-by: Maxime Chevallier --- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 7a67e23a2c2b..d8e5241097a9 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -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); } } -- 2.20.1