[dpdk-stable] patch 'net/ice/base: fix memory allocation wrapper' has been queued to stable release 19.11.9

Christian Ehrhardt christian.ehrhardt at canonical.com
Thu Jun 10 14:05:59 CEST 2021


Hi,

FYI, your patch has been queued to stable release 19.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/12/21. 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/cpaelzer/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/cpaelzer/dpdk-stable-queue/commit/8640d6ca2ee0fa8d9e427971f8c545422f4013dd

Thanks.

Christian Ehrhardt <christian.ehrhardt at canonical.com>

---
>From 8640d6ca2ee0fa8d9e427971f8c545422f4013dd Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand at redhat.com>
Date: Thu, 6 May 2021 12:07:02 +0200
Subject: [PATCH] net/ice/base: fix memory allocation wrapper

[ upstream commit 35f9cb006534018b6f69dce8f0d22684fe98e812 ]

This is reported by our internal covscan:

1. dpdk-20.11/drivers/net/ice/base/ice_switch.c:4214: sign_extension:
Suspicious implicit sign extension: "s_rule_size" with type "u16" (16
bits, unsigned) is promoted in "num_unicast * s_rule_size" to type "int"
(32 bits, signed), then sign-extended to type "unsigned long" (64 bits,
unsigned).
If "num_unicast * s_rule_size" is greater than 0x7FFFFFFF, the upper bits
of the result will all be 1.

 #  4212|   	s_rule_size = ICE_SW_RULE_RX_TX_ETH_HDR_SIZE;
 #  4213|   	s_rule = (struct ice_aqc_sw_rules_elem *)
 #  4214|-> 		ice_calloc(hw, num_unicast, s_rule_size);
 #  4215|   	if (!s_rule) {
 #  4216|   		status = ICE_ERR_NO_MEMORY;

Even if this condition is not likely to happen, in any case, it is more
straightforward to rely on the existing rte_calloc.

Fixes: 5f0978e96220 ("net/ice/base: add OS specific implementation")

Signed-off-by: David Marchand <david.marchand at redhat.com>
Acked-by: Qi Zhang <qi.z.zhang at intel.com>
---
 drivers/net/ice/base/ice_osdep.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h
index 32ac8ac397..ba0c57e1a9 100644
--- a/drivers/net/ice/base/ice_osdep.h
+++ b/drivers/net/ice/base/ice_osdep.h
@@ -173,7 +173,7 @@ struct ice_virt_mem {
 } __attribute__((packed));
 
 #define ice_malloc(h, s)    rte_zmalloc(NULL, s, 0)
-#define ice_calloc(h, c, s) rte_zmalloc(NULL, (c) * (s), 0)
+#define ice_calloc(h, c, s) rte_calloc(NULL, c, s, 0)
 #define ice_free(h, m)         rte_free(m)
 
 #define ice_memset(a, b, c, d) memset((a), (b), (c))
-- 
2.31.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-06-10 14:04:58.606840788 +0200
+++ 0011-net-ice-base-fix-memory-allocation-wrapper.patch	2021-06-10 14:04:58.018024288 +0200
@@ -1 +1 @@
-From 35f9cb006534018b6f69dce8f0d22684fe98e812 Mon Sep 17 00:00:00 2001
+From 8640d6ca2ee0fa8d9e427971f8c545422f4013dd Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 35f9cb006534018b6f69dce8f0d22684fe98e812 ]
+
@@ -26 +27,0 @@
-Cc: stable at dpdk.org
@@ -35 +36 @@
-index f4cc762e99..878c5597d4 100644
+index 32ac8ac397..ba0c57e1a9 100644
@@ -38,2 +39,2 @@
-@@ -207,7 +207,7 @@ struct ice_virt_mem {
- } __rte_packed;
+@@ -173,7 +173,7 @@ struct ice_virt_mem {
+ } __attribute__((packed));


More information about the stable mailing list