On Mon, Feb 14, 2022 at 01:30:29PM +0100, Klaus Jensen wrote: > @@ -384,6 +389,12 @@ static int nvme_ns_check_constraints(NvmeNamespace *ns, > Error **errp) > return -1; > } > > + if (ns->params.pif != NVME_PI_GUARD_16 && > + ns->params.pif != NVME_PI_GUARD_64) { > + error_setg(errp, "invalid 'pif'"); > + return -1; > + }
In addition, the requested metadata size ('params.ms') should be checked against the requested PI option. The function currently just checks against 8 bytes, but the 64b guard requires at least 16 bytes. Otherwise, looks great.