nvmf: add parameter check when loading reservation information from a JSON file

Change-Id: Id217212fd82e57a4cfb32f62f11798c72187879e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460794
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Changpeng Liu 2019-07-08 04:21:20 -04:00
parent 390cffb64e
commit 7b74274fbf

View File

@ -1459,6 +1459,12 @@ spdk_nvmf_ns_load_reservation(const char *file, struct spdk_nvmf_reservation_inf
goto exit;
}
if (res.regs.num_regs > SPDK_NVMF_MAX_NUM_REGISTRANTS) {
SPDK_ERRLOG("Can only support up to %u registrants\n", SPDK_NVMF_MAX_NUM_REGISTRANTS);
rc = -ERANGE;
goto exit;
}
rc = 0;
info->ptpl_activated = res.ptpl_activated;
info->rtype = res.rtype;