From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <cristian.dumitrescu@intel.com>,
<jasvinder.singh@intel.com>
Subject: [dpdk-dev] [PATCH 1/2] lib/sched: fix return value judgment
Date: Fri, 23 Apr 2021 19:01:11 +0800 [thread overview]
Message-ID: <1619175672-20016-2-git-send-email-humin29@huawei.com> (raw)
In-Reply-To: <1619175672-20016-1-git-send-email-humin29@huawei.com>
From: Huisong Li <lihuisong@huawei.com>
This patch fixes return value judgment when allocate memory to store the
subport profile, and releases memory of 'rte_sched_port' if code fails to
apply for this memory.
Fixes: 0ea4c6afcaf1 ("sched: add subport profile table")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
lib/sched/rte_sched.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c
index cd87e68..df0ab5c 100644
--- a/lib/sched/rte_sched.c
+++ b/lib/sched/rte_sched.c
@@ -961,9 +961,9 @@ rte_sched_port_config(struct rte_sched_port_params *params)
/* Allocate memory to store the subport profile */
port->subport_profiles = rte_zmalloc_socket("subport_profile", size2,
RTE_CACHE_LINE_SIZE, params->socket);
- if (port == NULL) {
+ if (port->subport_profiles == NULL) {
RTE_LOG(ERR, SCHED, "%s: Memory allocation fails\n", __func__);
-
+ rte_free(port);
return NULL;
}
--
2.7.4
next prev parent reply other threads:[~2021-04-23 11:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 11:01 [dpdk-dev] [PATCH 0/2] bugfix for sched Min Hu (Connor)
2021-04-23 11:01 ` Min Hu (Connor) [this message]
2021-07-13 22:16 ` [dpdk-dev] [PATCH 1/2] lib/sched: fix return value judgment Cristian Dumitrescu
2021-04-23 11:01 ` [dpdk-dev] [PATCH 2/2] lib/sched: optimize exception handling code Min Hu (Connor)
2021-07-13 22:20 ` Cristian Dumitrescu
2021-05-24 12:16 ` [dpdk-dev] [PATCH 0/2] bugfix for sched Min Hu (Connor)
2021-07-24 8:40 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1619175672-20016-2-git-send-email-humin29@huawei.com \
--to=humin29@huawei.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=jasvinder.singh@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.