From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-dm3nam03on0093.outbound.protection.outlook.com ([104.47.41.93]:53376 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388036AbeITI3f (ORCPT ); Thu, 20 Sep 2018 04:29:35 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Jacob Keller , Jeff Kirsher , Sasha Levin Subject: [PATCH AUTOSEL 4.18 40/56] i40e: fix condition of WARN_ONCE for stat strings Date: Thu, 20 Sep 2018 02:47:55 +0000 Message-ID: <20180920024716.58490-40-alexander.levin@microsoft.com> References: <20180920024716.58490-1-alexander.levin@microsoft.com> In-Reply-To: <20180920024716.58490-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Jacob Keller [ Upstream commit 07f3701387dcab3a4fb0166098fb2754a1b927e1 ] Commit 9b10df596bd4 ("i40e: use WARN_ONCE to replace the commented BUG_ON size check") introduced a warning check to make sure that the size of the stat strings was always the expected value. This code accidentally inverted the check of the data pointer. Fix this so that we accurately count the size of the stats we copied in. This fixes an erroneous WARN kernel splat that occurs when requesting ethtool statistics. Signed-off-by: Jacob Keller Tested-by: Andrew Bowers Tested-by: Mauro S M Rodrigues Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/e= thernet/intel/i40e/i40e_ethtool.c index 6947a2a571cb..5d670f4ce5ac 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -1903,7 +1903,7 @@ static void i40e_get_stat_strings(struct net_device *= netdev, u8 *data) data +=3D ETH_GSTRING_LEN; } =20 - WARN_ONCE(p - data !=3D i40e_get_stats_count(netdev) * ETH_GSTRING_LEN, + WARN_ONCE(data - p !=3D i40e_get_stats_count(netdev) * ETH_GSTRING_LEN, "stat strings count mismatch!"); } =20 --=20 2.17.1