From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>, <ferruh.yigit@intel.com>,
<skori@marvell.com>, <jerinj@marvell.com>,
<anatoly.burakov@intel.com>, <harry.van.haaren@intel.com>,
<stephen@networkplumber.org>
Cc: <dev@dpdk.org>, <linuxarm@openeuler.org>
Subject: [dpdk-dev] [PATCH v3 2/2] eal: fix service core index validity
Date: Wed, 5 May 2021 12:10:07 +0800 [thread overview]
Message-ID: <1620187807-40049-3-git-send-email-fengchengwen@huawei.com> (raw)
In-Reply-To: <1620187807-40049-1-git-send-email-fengchengwen@huawei.com>
This patch adds checking for service core index validity when parsing
service corelist.
Fixes: 7dbd7a6413ef ("service: add -S corelist option")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
v2->v3:
* change patch's author
---
lib/eal/common/eal_common_options.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index 66f9114..97ab6e0 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -758,10 +758,10 @@ static int
eal_parse_service_corelist(const char *corelist)
{
struct rte_config *cfg = rte_eal_get_configuration();
- int i, idx = 0;
+ int i;
unsigned count = 0;
char *end = NULL;
- int min, max;
+ uint32_t min, max, idx;
uint32_t taken_lcore_count = 0;
if (corelist == NULL)
@@ -785,6 +785,8 @@ eal_parse_service_corelist(const char *corelist)
idx = strtoul(corelist, &end, 10);
if (errno || end == NULL)
return -1;
+ if (idx >= RTE_MAX_LCORE)
+ return -1;
while (isblank(*end))
end++;
if (*end == '-') {
--
2.8.1
next prev parent reply other threads:[~2021-05-05 4:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-21 1:17 [dpdk-dev] [PATCH 0/2] fix bugs for librte eal Min Hu (Connor)
2021-04-21 1:17 ` [dpdk-dev] [PATCH 1/2] eal: check mp reply result Min Hu (Connor)
2021-04-21 1:17 ` [dpdk-dev] [PATCH 2/2] eal: fix service core index validity Min Hu (Connor)
2021-04-21 2:33 ` Stephen Hemminger
2021-04-29 2:34 ` Min Hu (Connor)
2021-04-29 2:34 ` [dpdk-dev] [PATCH v2 0/2] fix bugs for librte eal Min Hu (Connor)
2021-04-29 2:34 ` [dpdk-dev] [PATCH v2 1/2] eal: check mp reply result Min Hu (Connor)
2021-05-04 16:54 ` Thomas Monjalon
2021-04-29 2:34 ` [dpdk-dev] [PATCH v2 2/2] eal: fix service core index validity Min Hu (Connor)
2021-05-04 16:54 ` Thomas Monjalon
2021-05-05 4:10 ` [dpdk-dev] [PATCH v3 0/2] fix bugs for librte eal Chengwen Feng
2021-05-05 4:10 ` [dpdk-dev] [PATCH v3 1/2] eal: check mp reply result Chengwen Feng
2021-05-05 4:10 ` Chengwen Feng [this message]
2021-05-05 10:43 ` [dpdk-dev] [PATCH v3 2/2] eal: fix service core index validity Van Haaren, Harry
2021-05-05 21:23 ` 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=1620187807-40049-3-git-send-email-fengchengwen@huawei.com \
--to=fengchengwen@huawei.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=harry.van.haaren@intel.com \
--cc=jerinj@marvell.com \
--cc=linuxarm@openeuler.org \
--cc=skori@marvell.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).