env_dpdk: fix potential null dereference
Change-Id: Iff5cfa780506191b3a7fb218c6b5948df2ac16a4 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/523 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
a9a472b99b
commit
3ac9ba25f3
@ -271,9 +271,13 @@ spdk_build_eal_cmdline(const struct spdk_env_opts *opts)
|
||||
*/
|
||||
if (opts->core_mask[0] == '[') {
|
||||
char *l_arg = _sprintf_alloc("-l %s", opts->core_mask + 1);
|
||||
int len = strlen(l_arg);
|
||||
if (l_arg[len - 1] == ']') {
|
||||
l_arg[len - 1] = '\0';
|
||||
|
||||
if (l_arg != NULL) {
|
||||
int len = strlen(l_arg);
|
||||
|
||||
if (l_arg[len - 1] == ']') {
|
||||
l_arg[len - 1] = '\0';
|
||||
}
|
||||
}
|
||||
args = spdk_push_arg(args, &argcount, l_arg);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user