Received: by 10.192.165.156 with SMTP id m28csp43234imm; Tue, 10 Apr 2018 16:01:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/0uw2Aq4M1vU/P1yjz764PtnnEu6OnL+GeY2F1eaHYzeXdNe+HC/BWZsEdF/XoiZVGprP0 X-Received: by 10.101.74.193 with SMTP id c1mr1634144pgu.116.1523401309741; Tue, 10 Apr 2018 16:01:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523401309; cv=none; d=google.com; s=arc-20160816; b=ZqovxiDb9kQpU/8v0r1tKtSPVi9micCGR73dK2uaSD45CrY8NmMObJMeg9KqI+CqZV XuuuQrHy9m3GlDVxABCC2EF/8wAxTdK/oQ85amrm2kUeQXjwLIn2PHDAlGVH5KBWXOsG SROSGnYz+b+5lK8inMVYoE/UwZeWPb1HVyPiTgVEg9AhY0eG8g/IKJ53vDYRSFwSRg/Q pjkyrdhzvvm2kOlEsTolwC43IFYPnF1CjxDq5X48o0jd8L1C1m2zLzajYJ7NJteaUI4W yJWA+TjcyYqq+1IYdkDYLZKkS5DPiw7yDNlok7dRyM1qM84g+JQ3lQvVEbpHGY+rFjnk b3UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=on1fYisco1lEV1Z+GN0p/gZ4BszWjK8EN4O3Bj5KR9E=; b=UN2T/8NutHZQsQFAQSQfB5qaI/hIBeV40bSGmDtbdlsW0MoL1wLLKF6xW4C6HNwGF7 denciqsgVaYfkTsr/Iw/2Lj09O7TrH3c/iQYsz/4JS0ryKsknf6ajgllTXUsG2NnGJI5 l2uK9+b7AvHWkg0my8Zy67vEIJ2pYWt3W0VsrLyVQ1TLfKrV9oTX++QNLhqSDG1t4+Sg caG5iBvpMcRZ328AgaHuzt0LaSzATq1QRaX3S6TTEgSBGBcodfGGIyqPUmBD/MfUV7/R FT8P0S4Tqa/SILDNxPbgrwY7pCsCwgAQVRv32AUFLAkcJ2ZgJlG2EfyXxARUj6+VZu70 ZNVw== 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 r7si2431668pgv.368.2018.04.10.16.01.11; Tue, 10 Apr 2018 16:01:49 -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 S1755724AbeDJWgz (ORCPT + 99 others); Tue, 10 Apr 2018 18:36:55 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43596 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754852AbeDJWgx (ORCPT ); Tue, 10 Apr 2018 18:36:53 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5EDD7408; Tue, 10 Apr 2018 22:36:52 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Shen , Peng Li , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 054/138] net: hns3: Fix a loop index error of tqp statistics query Date: Wed, 11 Apr 2018 00:24:04 +0200 Message-Id: <20180410212908.378080215@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jian Shen [ Upstream commit 94bfaafac9d2a3c0bcca00d01e38f7597b741799 ] An error loop index was used while querying statistics data of tqps, which may cause call trace. Fixes: 496d03e960ae ("net: hns3: Add Ethtool support to HNS3 driver") Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c @@ -189,13 +189,13 @@ static u64 *hns3_get_stats_tqps(struct h struct hnae3_knic_private_info *kinfo = &handle->kinfo; struct hns3_enet_ring *ring; u8 *stat; - u32 i; + int i, j; /* get stats for Tx */ for (i = 0; i < kinfo->num_tqps; i++) { ring = nic_priv->ring_data[i].ring; - for (i = 0; i < HNS3_TXQ_STATS_COUNT; i++) { - stat = (u8 *)ring + hns3_txq_stats[i].stats_offset; + for (j = 0; j < HNS3_TXQ_STATS_COUNT; j++) { + stat = (u8 *)ring + hns3_txq_stats[j].stats_offset; *data++ = *(u64 *)stat; } } @@ -203,8 +203,8 @@ static u64 *hns3_get_stats_tqps(struct h /* get stats for Rx */ for (i = 0; i < kinfo->num_tqps; i++) { ring = nic_priv->ring_data[i + kinfo->num_tqps].ring; - for (i = 0; i < HNS3_RXQ_STATS_COUNT; i++) { - stat = (u8 *)ring + hns3_rxq_stats[i].stats_offset; + for (j = 0; j < HNS3_RXQ_STATS_COUNT; j++) { + stat = (u8 *)ring + hns3_rxq_stats[j].stats_offset; *data++ = *(u64 *)stat; } }