patch 'net/ice/base: fix size when allocating children arrays' has been queued to stable release 21.11.8

Kevin Traynor ktraynor at redhat.com
Fri Aug 23 18:18:33 CEST 2024


Hi,

FYI, your patch has been queued to stable release 21.11.8

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/28/24. 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/kevintraynor/dpdk-stable

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

Thanks.

Kevin

---
>From bc355f5741338ff94e43f55a96574455c2d168a8 Mon Sep 17 00:00:00 2001
From: Jacob Keller <jacob.e.keller at intel.com>
Date: Wed, 26 Jun 2024 12:41:08 +0100
Subject: [PATCH] net/ice/base: fix size when allocating children arrays

[ upstream commit 3072e5e2da9870d8cb119f15482eae9d9fb51e98 ]

The ice_sched_add_root_node() and ice_sched_add_node() functions have
comments to suppress Coverity warnings about a suspicious sizeof used
when allocating the children array of an struct ice_sched_node.

The size is calculated using the size of the scheduler node, which
overallocates the array by a significant amount.

Fix the code to correctly calculate the size by using *root->children
and *node->children respectively.

This saves some memory and allows us to drop the Coverity suppression
comments.

Fixes: 93e84b1bfc92 ("net/ice/base: add basic Tx scheduler")

Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
Signed-off-by: Ian Stokes <ian.stokes at intel.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 drivers/net/ice/base/ice_sched.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ice/base/ice_sched.c b/drivers/net/ice/base/ice_sched.c
index 92451c2f83..2944a6fd48 100644
--- a/drivers/net/ice/base/ice_sched.c
+++ b/drivers/net/ice/base/ice_sched.c
@@ -29,7 +29,6 @@ ice_sched_add_root_node(struct ice_port_info *pi,
 		return ICE_ERR_NO_MEMORY;
 
-	/* coverity[suspicious_sizeof] */
 	root->children = (struct ice_sched_node **)
-		ice_calloc(hw, hw->max_children[0], sizeof(*root));
+		ice_calloc(hw, hw->max_children[0], sizeof(*root->children));
 	if (!root->children) {
 		ice_free(hw, root);
@@ -181,7 +180,7 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer,
 		return ICE_ERR_NO_MEMORY;
 	if (hw->max_children[layer]) {
-		/* coverity[suspicious_sizeof] */
 		node->children = (struct ice_sched_node **)
-			ice_calloc(hw, hw->max_children[layer], sizeof(*node));
+			ice_calloc(hw, hw->max_children[layer],
+				   sizeof(*node->children));
 		if (!node->children) {
 			ice_free(hw, node);
-- 
2.46.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-08-23 17:18:12.249654902 +0100
+++ 0085-net-ice-base-fix-size-when-allocating-children-array.patch	2024-08-23 17:18:09.767430269 +0100
@@ -1 +1 @@
-From 3072e5e2da9870d8cb119f15482eae9d9fb51e98 Mon Sep 17 00:00:00 2001
+From bc355f5741338ff94e43f55a96574455c2d168a8 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 3072e5e2da9870d8cb119f15482eae9d9fb51e98 ]
+
@@ -20 +21,0 @@
-Cc: stable at dpdk.org
@@ -30 +31 @@
-index c9d70fb043..74d57329da 100644
+index 92451c2f83..2944a6fd48 100644
@@ -42 +43 @@
-@@ -187,7 +186,7 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer,
+@@ -181,7 +180,7 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer,



More information about the stable mailing list