[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/15] hw/block/nvme: fix uint16_t use of uint32_t sgls member
From: |
Max Reitz |
Subject: |
[PULL 05/15] hw/block/nvme: fix uint16_t use of uint32_t sgls member |
Date: |
Mon, 9 Nov 2020 18:38:29 +0100 |
From: Klaus Jensen <k.jensen@samsung.com>
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>
---
hw/block/nvme.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
}
--
2.28.0
- [PULL 00/15] Block patches for 5.2.0-rc1, Max Reitz, 2020/11/09
- [PULL 01/15] block: Remove unused include, Max Reitz, 2020/11/09
- [PULL 02/15] block: Move bdrv_drain_all_end_quiesce() to block_int.h, Max Reitz, 2020/11/09
- [PULL 03/15] qcow2: Document and enforce the QCowL2Meta invariants, Max Reitz, 2020/11/09
- [PULL 04/15] hw/block/nvme: fix null ns in register namespace, Max Reitz, 2020/11/09
- [PULL 05/15] hw/block/nvme: fix uint16_t use of uint32_t sgls member,
Max Reitz <=
- [PULL 06/15] hw/block/nvme: fix free of array-typed value, Max Reitz, 2020/11/09
- [PULL 08/15] iotests: rewrite iotest 240 in python, Max Reitz, 2020/11/09
- [PULL 07/15] iotests: add filter_qmp_virtio_scsi function, Max Reitz, 2020/11/09
- [PULL 09/15] block: Fixes nfs compiling error on msys2/mingw, Max Reitz, 2020/11/09
- [PULL 13/15] block: add forgotten bdrv_abort_perm_update() to bdrv_co_invalidate_cache(), Max Reitz, 2020/11/09
- [PULL 10/15] block: enable libnfs on msys2/mingw in cirrus.yml, Max Reitz, 2020/11/09
- [PULL 14/15] block: add bdrv_replace_node_common(), Max Reitz, 2020/11/09
- [PULL 12/15] block: Fix some code style problems, "foo* bar" should be "foo *bar", Max Reitz, 2020/11/09
- [PULL 11/15] block: Fix integer promotion error in bdrv_getlength(), Max Reitz, 2020/11/09
- [PULL 15/15] block: make bdrv_drop_intermediate() less wrong, Max Reitz, 2020/11/09