Skip to content

Commit

Permalink
hw/nvme: fix invalid endian conversion
Browse files Browse the repository at this point in the history
numcntl is one byte and so is max_vfs. Using cpu_to_le16 on big endian
hosts results in numcntl being set to 0.

Fix by dropping the endian conversion.

Fixes: 99f48ae ("hw/nvme: Add support for Secondary Controller List")
Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Minwoo Im <minwoo.im@samsung.com>
Message-ID: <20240222-fix-sriov-numcntl-v1-1-d60bea5e72d0@samsung.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit d2b5bb8)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
birkelund authored and Michael Tokarev committed Feb 27, 2024
1 parent a15b7df commit d3c3bc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hw/nvme/ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -7140,7 +7140,7 @@ static void nvme_init_state(NvmeCtrl *n)
n->aer_reqs = g_new0(NvmeRequest *, n->params.aerl + 1);
QTAILQ_INIT(&n->aer_queue);

list->numcntl = cpu_to_le16(max_vfs);
list->numcntl = max_vfs;
for (i = 0; i < max_vfs; i++) {
sctrl = &list->sec[i];
sctrl->pcid = cpu_to_le16(n->cntlid);
Expand Down

0 comments on commit d3c3bc7

Please sign in to comment.