Looks good,
Reviewed-by: Dmitry Fomichev
On Mon, 2020-06-29 at 20:26 +0200, Klaus Jensen wrote:
> From: Klaus Jensen
>
> 0x is not an allowed value for NCQR and NSQR in Set Features on
> Number of Queues.
>
> Signed-off-by: Klaus Jensen
> Acked-by: Keith Busch
> Reviewed-by: Maxim Levitsky
> ---
> hw/block/nvme.c | 8
> 1 file changed, 8 insertions(+)
>
> diff --git a/hw/block/nvme.c b/hw/block/nvme.c
> index a41665746d33..2279d8395aaa 100644
> --- a/hw/block/nvme.c
> +++ b/hw/block/nvme.c
> @@ -1257,6 +1257,14 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd
> *cmd, NvmeRequest *req)
> blk_set_enable_write_cache(n->conf.blk, dw11 & 1);
> break;
> case NVME_NUMBER_OF_QUEUES:
> +/*
> + * NVMe v1.3, Section 5.21.1.7: 0x is not an allowed value for
> NCQR
> + * and NSQR.
> + */
> +if ((dw11 & 0x) == 0x || ((dw11 >> 16) & 0x) == 0x) {
> +return NVME_INVALID_FIELD | NVME_DNR;
> +}
> +
> trace_pci_nvme_setfeat_numq((dw11 & 0x) + 1,
> ((dw11 >> 16) & 0x) + 1,
> n->params.max_ioqpairs,