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>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
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)
idx = strtoul(corelist, &end, 10);
if (errno || end == NULL)
return -1;
+ if (idx >= RTE_MAX_LCORE)
+ return -1;
while (isblank(*end))
end++;
if (*end == '-') {