eal: check string parameter lengths
When specifying parameters such as hugefile prefix from the command-line, it is possibly to supply an empty string. This may lead to various problems: for example, if hugefile prefix is empty, the runtime config path construction may end up looking like "/var/run/dpdk//_config", which will technically work, but is wrong and places files in the wrong place. To fix it, check lengths of such user-specified parameters for hugefile prefix, as well as hugepage dir and user-specified mbuf pool ops string. Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
This commit is contained in:
parent
7b55015e14
commit
2383d8e909
@ -1415,6 +1415,21 @@ eal_check_common_options(struct internal_config *internal_cfg)
|
||||
RTE_LOG(ERR, EAL, "Invalid process type specified\n");
|
||||
return -1;
|
||||
}
|
||||
if (internal_cfg->hugefile_prefix != NULL &&
|
||||
strlen(internal_cfg->hugefile_prefix) < 1) {
|
||||
RTE_LOG(ERR, EAL, "Invalid length of --" OPT_FILE_PREFIX " option\n");
|
||||
return -1;
|
||||
}
|
||||
if (internal_cfg->hugepage_dir != NULL &&
|
||||
strlen(internal_cfg->hugepage_dir) < 1) {
|
||||
RTE_LOG(ERR, EAL, "Invalid length of --" OPT_HUGE_DIR" option\n");
|
||||
return -1;
|
||||
}
|
||||
if (internal_cfg->user_mbuf_pool_ops_name != NULL &&
|
||||
strlen(internal_cfg->user_mbuf_pool_ops_name) < 1) {
|
||||
RTE_LOG(ERR, EAL, "Invalid length of --" OPT_MBUF_POOL_OPS_NAME" option\n");
|
||||
return -1;
|
||||
}
|
||||
if (index(eal_get_hugefile_prefix(), '%') != NULL) {
|
||||
RTE_LOG(ERR, EAL, "Invalid char, '%%', in --"OPT_FILE_PREFIX" "
|
||||
"option\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user