diff options
-rw-r--r-- | hw/block/nvme-dif.c | 2 | ||||
-rw-r--r-- | hw/block/nvme.c | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/hw/block/nvme-dif.c b/hw/block/nvme-dif.c index 2038d724bd..e6f04faafb 100644 --- a/hw/block/nvme-dif.c +++ b/hw/block/nvme-dif.c @@ -432,7 +432,7 @@ uint16_t nvme_dif_rw(NvmeCtrl *n, NvmeRequest *req) status = nvme_map_dptr(n, &req->sg, mapped_len, &req->cmd); if (status) { - return status; + goto err; } ctx->data.bounce = g_malloc(len); diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 6842b01ab5..c54ec3c952 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -5009,9 +5009,15 @@ static uint16_t nvme_format_ns(NvmeCtrl *n, NvmeNamespace *ns, uint8_t lbaf, } - (*count)--; + if (--(*count)) { + return NVME_NO_COMPLETE; + } - return NVME_NO_COMPLETE; + g_free(count); + ns->status = 0x0; + (*num_formats)--; + + return NVME_SUCCESS; } static uint16_t nvme_format(NvmeCtrl *n, NvmeRequest *req) |