diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 42abf72d388440832d38970f3c5a79c4f07c0452..84937089d5db7f111c99e6a1fe8f9444fffedef3 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -1439,7 +1439,7 @@ static int nvme_user_admin_cmd(struct nvme_dev *dev, nvme_free_iod(dev, iod); } - if (!status && copy_to_user(&ucmd->result, &cmd.result, + if ((status >= 0) && copy_to_user(&ucmd->result, &cmd.result, sizeof(cmd.result))) status = -EFAULT;