patch 'net/hns3: fix variable type mismatch' has been queued to stable release 20.11.9

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Jun 15 03:32:22 CEST 2023


Hi,

FYI, your patch has been queued to stable release 20.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/17/23. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/cb532b2040d32a84c7356766f37d73d0f2c2666a

Thanks.

Luca Boccassi

---
>From cb532b2040d32a84c7356766f37d73d0f2c2666a Mon Sep 17 00:00:00 2001
From: Dengdui Huang <huangdengdui at huawei.com>
Date: Mon, 22 May 2023 21:17:38 +0800
Subject: [PATCH] net/hns3: fix variable type mismatch

[ upstream commit 1bbac8785cdf51bc6c5005c6754eab4d517cc4b0 ]

Loop conditions are compared with different variable types,
which may cause overflow risks.

Fixes: 67d010346933 ("net/hns3: adjust data type of some variables")
Fixes: 6ee07e3cb589 ("net/hns3: fix insecure way to query MAC statistics")

Signed-off-by: Dengdui Huang <huangdengdui at huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3 at huawei.com>
---
 drivers/net/hns3/hns3_regs.c  | 5 +++--
 drivers/net/hns3/hns3_stats.c | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c
index cbc377adee..91261b1b1f 100644
--- a/drivers/net/hns3/hns3_regs.c
+++ b/drivers/net/hns3/hns3_regs.c
@@ -270,8 +270,9 @@ hns3_direct_access_regs(struct hns3_hw *hw, uint32_t *data)
 	struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
 	uint32_t *origin_data_ptr = data;
 	uint32_t reg_offset;
-	int reg_num;
-	int i, j;
+	size_t reg_num;
+	uint16_t j;
+	size_t i;
 
 	/* fetching per-PF registers values from PF PCIe register space */
 	reg_num = sizeof(cmdq_reg_addrs) / sizeof(uint32_t);
diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c
index 16cca25862..7e645361cf 100644
--- a/drivers/net/hns3/hns3_stats.c
+++ b/drivers/net/hns3/hns3_stats.c
@@ -338,7 +338,7 @@ hns3_update_mac_stats(struct hns3_hw *hw)
 	uint32_t stats_iterms;
 	uint64_t *desc_data;
 	uint32_t desc_num;
-	uint16_t i;
+	uint32_t i;
 	int ret;
 
 	/* The first desc has a 64-bit header, so need to consider it. */
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-06-15 01:56:36.176557594 +0100
+++ 0027-net-hns3-fix-variable-type-mismatch.patch	2023-06-15 01:56:34.575541478 +0100
@@ -1 +1 @@
-From 1bbac8785cdf51bc6c5005c6754eab4d517cc4b0 Mon Sep 17 00:00:00 2001
+From cb532b2040d32a84c7356766f37d73d0f2c2666a Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 1bbac8785cdf51bc6c5005c6754eab4d517cc4b0 ]
+
@@ -11 +12,0 @@
-Cc: stable at dpdk.org
@@ -16,2 +17 @@
- .mailmap                      | 1 +
- drivers/net/hns3/hns3_regs.c  | 3 ++-
+ drivers/net/hns3/hns3_regs.c  | 5 +++--
@@ -19 +19 @@
- 3 files changed, 4 insertions(+), 2 deletions(-)
+ 2 files changed, 4 insertions(+), 3 deletions(-)
@@ -21,12 +20,0 @@
-diff --git a/.mailmap b/.mailmap
-index 863dbecdb0..f00c1e5457 100644
---- a/.mailmap
-+++ b/.mailmap
-@@ -301,6 +301,7 @@ Deepak Khandelwal <deepak.khandelwal at intel.com>
- Deepak Kumar Jain <deepak.k.jain at intel.com>
- Deirdre O'Connor <deirdre.o.connor at intel.com>
- Dekel Peled <dekelp at nvidia.com> <dekelp at mellanox.com>
-+Dengdui Huang <huangdengdui at huawei.com>
- Denis Pryazhennikov <denis.pryazhennikov at arknetworks.am>
- Dennis Marinus <dmarinus at amazon.com>
- Derek Chickles <derek.chickles at caviumnetworks.com>
@@ -34 +22 @@
-index 33392fd1f0..5d6f92e4bb 100644
+index cbc377adee..91261b1b1f 100644
@@ -37 +25 @@
-@@ -294,8 +294,9 @@ hns3_direct_access_regs(struct hns3_hw *hw, uint32_t *data)
+@@ -270,8 +270,9 @@ hns3_direct_access_regs(struct hns3_hw *hw, uint32_t *data)
@@ -41,2 +29,3 @@
--	uint16_t i, j;
- 	size_t reg_num;
+-	int reg_num;
+-	int i, j;
++	size_t reg_num;
@@ -49 +38 @@
-index bad65fcbed..c2e692a2c5 100644
+index 16cca25862..7e645361cf 100644
@@ -52 +41 @@
-@@ -317,7 +317,7 @@ hns3_update_mac_stats(struct hns3_hw *hw)
+@@ -338,7 +338,7 @@ hns3_update_mac_stats(struct hns3_hw *hw)


More information about the stable mailing list