nvmf: check for missing NQN in conf parsing

Avoid dereferencing a NULL pointer if NQN wasn't specified in the
configuration file.

Change-Id: Ie43111fce2c5fcf06bad00af10413a665dfbc45f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/407484
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Daniel Verkamp 2018-04-12 09:56:06 -07:00
parent 6820d312e1
commit be0eef0a0d

View File

@ -151,6 +151,11 @@ spdk_nvmf_parse_subsystem(struct spdk_conf_section *sp)
int num_ns;
nqn = spdk_conf_section_get_val(sp, "NQN");
if (nqn == NULL) {
SPDK_ERRLOG("Subsystem missing NQN\n");
return -1;
}
mode = spdk_conf_section_get_val(sp, "Mode");
lcore = spdk_conf_section_get_intval(sp, "Core");
num_ns = spdk_conf_section_get_intval(sp, "MaxNamespaces");