Received: by 10.192.165.156 with SMTP id m28csp22268imm; Tue, 10 Apr 2018 15:33:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+hjTh3aKwkMzvoanlqxhZwSByW1kEYAknTpiJOzFF34ybiM4qpZ8WI0tpX62xJT39q4cNO X-Received: by 10.99.165.22 with SMTP id n22mr1551791pgf.53.1523399628022; Tue, 10 Apr 2018 15:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523399627; cv=none; d=google.com; s=arc-20160816; b=TVTV7QPn+9tRdYiwYzpKTfvSwvYsMYzjCq2x/1RKBsFj+8XGoSTKQs3hJ7pztiEFni 2UySqSAga2yGJD4xQB+4xBqC8bc8dBMYYOCidUZtDAgmeIt4HSWq++TixXXrSa9U1xjZ D0yayt7bxDyDjx7O/GZTVtkB3fmYUFUdoqNPp71nL2DHChp7hNlF7du0Zyd1sQF8sWCc GWD0C/kZe+F9/TlTAJq9bRRkeYAnXC40YpYseddliIW/wMp8gab0jYQh5xk4M6QHRyTr /aT1nv/k+Oh+1nND0xwBjXBrU3Wty8KiFjkk6ZcDa/wmurdn2u/4O8g29uZOGQwFIG5H UPYw== 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=AVvBXRTVARfpq5CbvKsouwit6F2XPV9o9+M994NQPyU=; b=oFnXu3NK8WScbAa7+tZk/4g7+nDffBpoURb+hAZNm5SSQO9UkTRZMNXE7GlODdv2LN 1/fPNO4dFjAp3USOKDa13j/tB52NILQ9Mo1IyBvsfA5fRrrtEn7qTEYBEMjGaTOLYN73 3Xy74fjx3w4RYIDtAhKdO3989k2IluGtOxU35XqukjUdhRA5MhKqcrayprcAvUOnUNR+ yi9/01UM7WxEbnQPdQSvzMlz9zsiXHwg75M8FR4TA2pnw7yEna3IIvGSqwPBYQ9hYAmL iFTGwG6WsoBqzbKCvHHWdRABoLi7/qqBeOdU/peMcvTclfaZzI29i+twa7MwbOzMV3Xz Cddg== 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 j197si2438641pgc.809.2018.04.10.15.33.11; Tue, 10 Apr 2018 15:33:47 -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 S1754167AbeDJW2z (ORCPT + 99 others); Tue, 10 Apr 2018 18:28:55 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39240 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754153AbeDJW2x (ORCPT ); Tue, 10 Apr 2018 18:28: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 59A23D09; Tue, 10 Apr 2018 22:28: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.15 069/168] net: hns3: Fix a loop index error of tqp statistics query Date: Wed, 11 Apr 2018 00:23:31 +0200 Message-Id: <20180410212803.132706603@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@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.15-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 @@ -455,13 +455,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; } } @@ -469,8 +469,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; } }