qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 01/11] hw/block/nvme: Add Commands Supported and Effects l


From: Keith Busch
Subject: Re: [PATCH v6 01/11] hw/block/nvme: Add Commands Supported and Effects log
Date: Tue, 13 Oct 2020 17:50:34 -0700

On Wed, Oct 14, 2020 at 06:42:02AM +0900, Dmitry Fomichev wrote:
> +{
> +    NvmeEffectsLog log = {};
> +    uint32_t *dst_acs = log.acs, *dst_iocs = log.iocs;
> +    uint32_t trans_len;
> +    int i;
> +
> +    trace_pci_nvme_cmd_supp_and_effects_log_read();
> +
> +    if (off >= sizeof(log)) {
> +        trace_pci_nvme_err_invalid_effects_log_offset(off);
> +        return NVME_INVALID_FIELD | NVME_DNR;
> +    }
> +
> +    for (i = 0; i < 256; i++) {
> +        dst_acs[i] = nvme_cse_acs[i];
> +    }
> +
> +    for (i = 0; i < 256; i++) {
> +        dst_iocs[i] = nvme_cse_iocs_nvm[i];
> +    }

You're just copying the array, so let's do it like this:

    memcpy(log.acs, nvme_cse_acs, sizeof(nvme_cse_acs));
    memcpy(log.iocs, nvme_cse_iocs_nvm, sizeof(nvme_cse_iocs_nvm));

I think you also need to check

    if (NVME_CC_CSS(n->bar.cc) != NVME_CC_CSS_ADMIN_ONLY)

before copying iocs.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]