Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2833682pxb; Mon, 1 Nov 2021 02:49:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7tae4dTef1WR/Tafn//oCJFzmW+H/aBam58Z/Cw05PPyHkZK6a7a5/pmx3AJYx4493Fni X-Received: by 2002:a05:6638:288:: with SMTP id c8mr6620972jaq.60.1635760145933; Mon, 01 Nov 2021 02:49:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635760145; cv=none; d=google.com; s=arc-20160816; b=mzksxKJJXBoJK545OYw4hDm+1oY2yJ9w8wc2MgduUu9xEWUGLW99A6/N5RDWEcho7L Z3qOFwQHV4qIpHF3LEdoH5JhxAaIZRvN3QpZPFGHLWUqLRY+5MzNBfPbcHvZ4GMGGxY+ hRDaP/WNQcDMy2AEW7kNAIiO8g+lc05i0MxtBXex/0LNK5BbKoxYxfl95cb6YYTlltqv BZtaJZL95Siyz5DbCrtY73iWNeyHxdRH60iUPvVE1KfjAdeBjjukN1GZJ8dSjHTWiFyz mK/KAAFOjZ5/Y6ktZhptCid5Uqrqaxyof35Zim6G83vN2Lklr4CKTUXcPHC4ZpLm8lZe /NHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VqxhWINFl0irAL3MpnC425p1nmUkQewcll3XweSzFaQ=; b=ELLaOxwLM0Y564GxTiu0mGTUlzFDDtZiizyjtWpLCU74E6U+cdqHsKuUMiSDzYX2un WXZI9dmNgnmAWLL3wdYYASw+RfrH6q9R6szZUo5PpvCNGg3JuAFrGEY2NBFDO39umQNY H2bZSeBG+Tw6OFcdFGHRMs/DzB3soGp31pI7147C6SSWU522cygdwlzOjRLmbRMhx84m s2cLHwb/GNcjcnvADRTqGenyMCfT+buVS2RIuiq/ksn1Fx+nzPvZvg+/XNGVAAv1L+nQ 4psokz/4S8FzpLhcBPnaTBHu9HXl4WrjGELCe8YJmJmS20qLNDYIJu4jhKeLmYRORvRk 0DYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xa414Njb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l25si11765590iok.6.2021.11.01.02.48.54; Mon, 01 Nov 2021 02:49:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xa414Njb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232479AbhKAJug (ORCPT + 99 others); Mon, 1 Nov 2021 05:50:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:51094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234565AbhKAJrK (ORCPT ); Mon, 1 Nov 2021 05:47:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 20075613DB; Mon, 1 Nov 2021 09:30:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635759040; bh=ZSFO595i7pmRGBTm8Yu/O+S22szZYMD9KTJPSPbmjpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xa414NjbwTLLxFn3GUZjSKrn7fHBVWqA1yrDNLinlpB/uvBV+/U0YbIc4L1bu6RXD AR4CqKJt5c5ibRV8UXOix/JYls0bUrU78AqIweE/f6+UR32O1OQmoongTdPOccCAJL Y5nhpXG998bhRcAvS2fzfS6bXpBntguXPQDWd3pE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie Wang , Guangbin Huang , "David S. Miller" Subject: [PATCH 5.14 089/125] net: hns3: fix data endian problem of some functions of debugfs Date: Mon, 1 Nov 2021 10:17:42 +0100 Message-Id: <20211101082550.010453252@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082533.618411490@linuxfoundation.org> References: <20211101082533.618411490@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jie Wang commit 2a21dab594a98c338c4bfbc31864cbca15888549 upstream. The member data in struct hclge_desc is type of __le32, it needs endian conversion before using it, and some functions of debugfs didn't do that, so this patch fixes it. Fixes: c0ebebb9ccc1 ("net: hns3: Add "dcb register" status information query function") Signed-off-by: Jie Wang Signed-off-by: Guangbin Huang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c | 30 ++++++------- 1 file changed, 14 insertions(+), 16 deletions(-) --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c @@ -391,7 +391,7 @@ static int hclge_dbg_dump_mac(struct hcl static int hclge_dbg_dump_dcb_qset(struct hclge_dev *hdev, char *buf, int len, int *pos) { - struct hclge_dbg_bitmap_cmd *bitmap; + struct hclge_dbg_bitmap_cmd req; struct hclge_desc desc; u16 qset_id, qset_num; int ret; @@ -408,12 +408,12 @@ static int hclge_dbg_dump_dcb_qset(struc if (ret) return ret; - bitmap = (struct hclge_dbg_bitmap_cmd *)&desc.data[1]; + req.bitmap = (u8)le32_to_cpu(desc.data[1]); *pos += scnprintf(buf + *pos, len - *pos, "%04u %#x %#x %#x %#x\n", - qset_id, bitmap->bit0, bitmap->bit1, - bitmap->bit2, bitmap->bit3); + qset_id, req.bit0, req.bit1, req.bit2, + req.bit3); } return 0; @@ -422,7 +422,7 @@ static int hclge_dbg_dump_dcb_qset(struc static int hclge_dbg_dump_dcb_pri(struct hclge_dev *hdev, char *buf, int len, int *pos) { - struct hclge_dbg_bitmap_cmd *bitmap; + struct hclge_dbg_bitmap_cmd req; struct hclge_desc desc; u8 pri_id, pri_num; int ret; @@ -439,12 +439,11 @@ static int hclge_dbg_dump_dcb_pri(struct if (ret) return ret; - bitmap = (struct hclge_dbg_bitmap_cmd *)&desc.data[1]; + req.bitmap = (u8)le32_to_cpu(desc.data[1]); *pos += scnprintf(buf + *pos, len - *pos, "%03u %#x %#x %#x\n", - pri_id, bitmap->bit0, bitmap->bit1, - bitmap->bit2); + pri_id, req.bit0, req.bit1, req.bit2); } return 0; @@ -453,7 +452,7 @@ static int hclge_dbg_dump_dcb_pri(struct static int hclge_dbg_dump_dcb_pg(struct hclge_dev *hdev, char *buf, int len, int *pos) { - struct hclge_dbg_bitmap_cmd *bitmap; + struct hclge_dbg_bitmap_cmd req; struct hclge_desc desc; u8 pg_id; int ret; @@ -466,12 +465,11 @@ static int hclge_dbg_dump_dcb_pg(struct if (ret) return ret; - bitmap = (struct hclge_dbg_bitmap_cmd *)&desc.data[1]; + req.bitmap = (u8)le32_to_cpu(desc.data[1]); *pos += scnprintf(buf + *pos, len - *pos, "%03u %#x %#x %#x\n", - pg_id, bitmap->bit0, bitmap->bit1, - bitmap->bit2); + pg_id, req.bit0, req.bit1, req.bit2); } return 0; @@ -511,7 +509,7 @@ static int hclge_dbg_dump_dcb_queue(stru static int hclge_dbg_dump_dcb_port(struct hclge_dev *hdev, char *buf, int len, int *pos) { - struct hclge_dbg_bitmap_cmd *bitmap; + struct hclge_dbg_bitmap_cmd req; struct hclge_desc desc; u8 port_id = 0; int ret; @@ -521,12 +519,12 @@ static int hclge_dbg_dump_dcb_port(struc if (ret) return ret; - bitmap = (struct hclge_dbg_bitmap_cmd *)&desc.data[1]; + req.bitmap = (u8)le32_to_cpu(desc.data[1]); *pos += scnprintf(buf + *pos, len - *pos, "port_mask: %#x\n", - bitmap->bit0); + req.bit0); *pos += scnprintf(buf + *pos, len - *pos, "port_shaping_pass: %#x\n", - bitmap->bit1); + req.bit1); return 0; }