diff options
author | Klaus Jensen | 2020-11-04 11:22:47 +0100 |
---|---|---|
committer | Max Reitz | 2020-11-09 15:44:21 +0100 |
commit | bf288953f13b4a3c57e6e59656ac5367491c65eb (patch) | |
tree | 24e0200c45b0189185afad12eac6d9b3c4aa0562 /hw/block | |
parent | hw/block/nvme: fix null ns in register namespace (diff) | |
download | qemu-bf288953f13b4a3c57e6e59656ac5367491c65eb.tar.gz qemu-bf288953f13b4a3c57e6e59656ac5367491c65eb.tar.xz qemu-bf288953f13b4a3c57e6e59656ac5367491c65eb.zip |
hw/block/nvme: fix uint16_t use of uint32_t sgls member
nvme_map_sgl_data erroneously uses the sgls member of NvmeIdNs as a
uint16_t.
Reported-by: Coverity (CID 1436129)
Fixes: cba0a8a344fe ("hw/block/nvme: add support for scatter gather lists")
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Message-Id: <20201104102248.32168-3-its@irrelevant.dk>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'hw/block')
-rw-r--r-- | hw/block/nvme.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 080d782f1c..2bdc50eb6f 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -452,7 +452,7 @@ static uint16_t nvme_map_sgl_data(NvmeCtrl *n, QEMUSGList *qsg, * segments and/or descriptors. The controller might accept * ignoring the rest of the SGL. */ - uint16_t sgls = le16_to_cpu(n->id_ctrl.sgls); + uint32_t sgls = le32_to_cpu(n->id_ctrl.sgls); if (sgls & NVME_CTRL_SGLS_EXCESS_LENGTH) { break; } |