[dpdk-stable] patch 'net/bnxt: add memory allocation check in VF info init' has been queued to stable release 19.11.6

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed Oct 28 11:42:49 CET 2020


Hi,

FYI, your patch has been queued to stable release 19.11.6

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

Thanks.

Luca Boccassi

---
>From fd2313c1bcc695f11b4c41ba76c96b6efc9a118a Mon Sep 17 00:00:00 2001
From: Yunjian Wang <wangyunjian at huawei.com>
Date: Fri, 31 Jul 2020 20:09:06 +0800
Subject: [PATCH] net/bnxt: add memory allocation check in VF info init

[ upstream commit 2477be96e7a34ee74314d2604b4943b5e317e627 ]

The function rte_malloc() could return NULL, the return
value need to be checked.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")

Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index fed1aa3297..15ec7248c2 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -613,8 +613,12 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 		if (new_max_vfs != bp->pf.max_vfs) {
 			if (bp->pf.vf_info)
 				rte_free(bp->pf.vf_info);
-			bp->pf.vf_info = rte_malloc("bnxt_vf_info",
+			bp->pf.vf_info = rte_zmalloc("bnxt_vf_info",
 			    sizeof(bp->pf.vf_info[0]) * new_max_vfs, 0);
+			if (bp->pf.vf_info == NULL) {
+				PMD_DRV_LOG(ERR, "Alloc vf info fail\n");
+				return -ENOMEM;
+			}
 			bp->pf.max_vfs = new_max_vfs;
 			for (i = 0; i < new_max_vfs; i++) {
 				bp->pf.vf_info[i].fid = bp->pf.first_vf_id + i;
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-10-28 10:35:12.098747169 +0000
+++ 0010-net-bnxt-add-memory-allocation-check-in-VF-info-init.patch	2020-10-28 10:35:11.404828552 +0000
@@ -1,13 +1,14 @@
-From 2477be96e7a34ee74314d2604b4943b5e317e627 Mon Sep 17 00:00:00 2001
+From fd2313c1bcc695f11b4c41ba76c96b6efc9a118a Mon Sep 17 00:00:00 2001
 From: Yunjian Wang <wangyunjian at huawei.com>
 Date: Fri, 31 Jul 2020 20:09:06 +0800
 Subject: [PATCH] net/bnxt: add memory allocation check in VF info init
 
+[ upstream commit 2477be96e7a34ee74314d2604b4943b5e317e627 ]
+
 The function rte_malloc() could return NULL, the return
 value need to be checked.
 
 Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
-Cc: stable at dpdk.org
 
 Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
 Reviewed-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
@@ -16,23 +17,23 @@
  1 file changed, 5 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
-index 643dd98977..43e3e27537 100644
+index fed1aa3297..15ec7248c2 100644
 --- a/drivers/net/bnxt/bnxt_hwrm.c
 +++ b/drivers/net/bnxt/bnxt_hwrm.c
-@@ -711,8 +711,12 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
- 		if (new_max_vfs != bp->pf->max_vfs) {
- 			if (bp->pf->vf_info)
- 				bnxt_hwrm_free_vf_info(bp);
--			bp->pf->vf_info = rte_malloc("bnxt_vf_info",
-+			bp->pf->vf_info = rte_zmalloc("bnxt_vf_info",
- 			    sizeof(bp->pf->vf_info[0]) * new_max_vfs, 0);
-+			if (bp->pf->vf_info == NULL) {
+@@ -613,8 +613,12 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
+ 		if (new_max_vfs != bp->pf.max_vfs) {
+ 			if (bp->pf.vf_info)
+ 				rte_free(bp->pf.vf_info);
+-			bp->pf.vf_info = rte_malloc("bnxt_vf_info",
++			bp->pf.vf_info = rte_zmalloc("bnxt_vf_info",
+ 			    sizeof(bp->pf.vf_info[0]) * new_max_vfs, 0);
++			if (bp->pf.vf_info == NULL) {
 +				PMD_DRV_LOG(ERR, "Alloc vf info fail\n");
 +				return -ENOMEM;
 +			}
- 			bp->pf->max_vfs = new_max_vfs;
+ 			bp->pf.max_vfs = new_max_vfs;
  			for (i = 0; i < new_max_vfs; i++) {
- 				bp->pf->vf_info[i].fid =
+ 				bp->pf.vf_info[i].fid = bp->pf.first_vf_id + i;
 -- 
 2.20.1
 


More information about the stable mailing list