Received: by 10.213.65.68 with SMTP id h4csp43660imn; Mon, 19 Mar 2018 18:59:45 -0700 (PDT) X-Google-Smtp-Source: AG47ELsz8LJAfZUCowc25F88u47dsHHYDQ6VAfd28PK2wPtdFOL6z/hNUaaCReOZ/UOuGugeUa9d X-Received: by 10.101.97.67 with SMTP id o3mr10950674pgv.251.1521511185360; Mon, 19 Mar 2018 18:59:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521511185; cv=none; d=google.com; s=arc-20160816; b=dcgDFfZLMtnJ3oTY3Nt7xZRcWgbLt5ia7Em6VAersxSmyuGoRBaQVmlnrDFUXidAi7 1XUiKJB4XcQVD0ML+NAprHXG8HTbNKYGDzmDypuIpIoOrjSJUKAfw5acFr0HdFc0+zRg wto36cydBUq3q5NLwWn7dMLKe8JCWFwyIq1cUkES4GMAkZltvHqagiupnZx51CTemjBk Qq8/J9H6cCiJMlzJ/JA9fXDcg0Zh+2gFt1o1/hts/dbLYOunUKUGSRvI7wuUz1CNNWnu n2redZGFaXOzH7i24BSSjo6kuT3E/2HD7ECLX8vEvFl0QZZu5cXBeyAWTm+9GIjQqyyg swIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=SndDNy2XT68ICGrNPYSmWZbskimfE7PaKTtpw+Wj4L0=; b=C2kis6SiNvF8EibFvM3AA3O0hTlJSu68Kd6xbQ90dmFggBFGrdWa1aCc5RI7ktz8Fu FQWRscbAjaLMZ/4+NWR5RrwAgEpa+rNcGvPs1H6/yRjg0krBBzZs+Ssdhd09c2b2ZRwh 6OLqxDoxALi7tL6s4EJeGg+8Coco4m2PwBypp2bxXI46t4wmYFtMuC/1m/uLiiygHvg3 +SzngR//Jml3ls6J0PKi2LXjbfnGUiTh0KZqkLkup0U/10ssjXRA2Uu4cBaG2vaet5Oq 0fUlhw8Bk+PVcJrjw4T/yxyKLOOiMKoaUKVqR8Bho13pHdfkecsd/DxGr2834/A2yT/r 428A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=i6FQUsxc; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m39-v6si554603plg.447.2018.03.19.18.59.31; Mon, 19 Mar 2018 18:59:45 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=i6FQUsxc; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936429AbeCSWU2 (ORCPT + 99 others); Mon, 19 Mar 2018 18:20:28 -0400 Received: from mail-cys01nam02on0111.outbound.protection.outlook.com ([104.47.37.111]:18692 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933847AbeCSPtV (ORCPT ); Mon, 19 Mar 2018 11:49:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=SndDNy2XT68ICGrNPYSmWZbskimfE7PaKTtpw+Wj4L0=; b=i6FQUsxcLEiuluZ4JNCVmGd+xjig9ktT8yQ5u8fahXvGcBNSD29ttKx63ZGCg7eEnTy73o51U0TBBIAQQzyuuhh908gdrev6/lPl4bbCS+MRnU5rJgorjtACKZwb+W3/5oNf8GBQmdpodc3tRjH+Q+AzPP8gELXuUVkYcQL4hT4= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0919.namprd21.prod.outlook.com (52.132.132.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:48:59 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:48:59 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Jian Shen , Peng Li , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 079/124] net: hns3: Fix a loop index error of tqp statistics query Thread-Topic: [PATCH AUTOSEL for 4.15 079/124] net: hns3: Fix a loop index error of tqp statistics query Thread-Index: AQHTv5m4k0i9lXT1iEiQaPHItQ2Xpw== Date: Mon, 19 Mar 2018 15:48:26 +0000 Message-ID: <20180319154645.11350-79-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0919;7:J2xK/CUyaSNpeQQofH6EChQIOt+xRw6/YIvAgB0N14oUcjHlpeFNkZhMWE6rXaVHqXjpM0GzmRqgIY7wbkRDj1qeYxUPcs7EoyQsQUh3jYok4DqXPtiYpLl2nywi+K7vs6o1VD1Rq/RIxlwSKLA3YIfjsFDQaQrSGh3W8kVPpit5bgwQXcGRRhSHwOGsig7iDg2lW3gKQr5/ry50M4GyymG+pbGAfolx0RcW26TkgL/jj6ex17lR5ywnUd2kZiKi;20:EHx20Je9kYhCMj2YOKrt3HeHgOyx8FwtTCt51dB9V2X7CO8guDYso3+7pEcgC6MXhXQByKs18vJWldizQnDWRvQNsJ+xKjcif41A0ryLCCvIxpNwlOiZFUa6azTC0nO5PHhL78zO1MsP1oEMZJA/UZbWiGS/bCfHYITWcwJ/DRI= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 3a29bf74-0284-4c26-bac5-08d58db0ee7c x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0919; x-ms-traffictypediagnostic: DM5PR2101MB0919: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(50582790962513); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB0919;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0919; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(366004)(39860400002)(396003)(39380400002)(346002)(199004)(189003)(6512007)(5250100002)(106356001)(99286004)(102836004)(2501003)(6116002)(1076002)(3846002)(186003)(10090500001)(76176011)(6486002)(25786009)(316002)(26005)(22452003)(68736007)(6436002)(2900100001)(54906003)(2950100002)(6666003)(72206003)(81156014)(3660700001)(4326008)(7736002)(110136005)(305945005)(478600001)(3280700002)(6506007)(97736004)(81166006)(8676002)(10290500003)(575784001)(66066001)(2906002)(86362001)(105586002)(8936002)(53936002)(36756003)(14454004)(86612001)(5660300001)(107886003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0919;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: bFygRiDPY54tiYYUn6qRMbSyFYCaoiFCQQg04bt6LX/jjKqQUY8HatVSCSIHK21GUzM7gxc7dL0BTJOrJgp1nnHhsK4p1yFIsjrOoC3iuLwj80WmtovvYunTs9sCA/BnSQEgBbKoPtEDUs69XsCin77B6T/VJ26cL9qtgQLXHDO5r30KC33M4jFACeUsSiueKmPHK0wl3A8WvWIHTcrtEM3VfPAdDaYAErLOWmKSN+CRP2oyK/1stelAGyKjsLjHaTO+dUi6ZdBuTMYX+WUA1mZeTdchNBrYTon7wpzt4SX8gI2evGIL4qnLtkdHnckiTZAYaPS+c3xT6mqrL3ZWjQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a29bf74-0284-4c26-bac5-08d58db0ee7c X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:48:26.9065 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0919 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c b/dr= ivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_ethtool.c index a21470c72da3..485497a04d7d 100644 --- 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 hnae3_handle *= handle, u64 *data) struct hnae3_knic_private_info *kinfo =3D &handle->kinfo; struct hns3_enet_ring *ring; u8 *stat; - u32 i; + int i, j; =20 /* get stats for Tx */ for (i =3D 0; i < kinfo->num_tqps; i++) { ring =3D nic_priv->ring_data[i].ring; - for (i =3D 0; i < HNS3_TXQ_STATS_COUNT; i++) { - stat =3D (u8 *)ring + hns3_txq_stats[i].stats_offset; + for (j =3D 0; j < HNS3_TXQ_STATS_COUNT; j++) { + stat =3D (u8 *)ring + hns3_txq_stats[j].stats_offset; *data++ =3D *(u64 *)stat; } } @@ -469,8 +469,8 @@ static u64 *hns3_get_stats_tqps(struct hnae3_handle *ha= ndle, u64 *data) /* get stats for Rx */ for (i =3D 0; i < kinfo->num_tqps; i++) { ring =3D nic_priv->ring_data[i + kinfo->num_tqps].ring; - for (i =3D 0; i < HNS3_RXQ_STATS_COUNT; i++) { - stat =3D (u8 *)ring + hns3_rxq_stats[i].stats_offset; + for (j =3D 0; j < HNS3_RXQ_STATS_COUNT; j++) { + stat =3D (u8 *)ring + hns3_rxq_stats[j].stats_offset; *data++ =3D *(u64 *)stat; } } --=20 2.14.1