From d4304f43843693a74bce42cfa98b144611fc4e3a Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 21 Apr 2020 00:41:57 -0400 Subject: [PATCH] nvme_disk: Correct get_memory_map invocation. Passing "1" as the bytes argument instead of "0" means that get_memory_map would never return an error in the case that one physical_entry was not enough for the vaddr's map. This reveals the true cause of the disk corruptions: libnvme is assuming some of the passed buffers are physically contiguous, and they are not. --- .../kernel/drivers/disk/nvme/compat/libnvme_haiku.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/drivers/disk/nvme/compat/libnvme_haiku.cpp b/src/add-ons/kernel/drivers/disk/nvme/compat/libnvme_haiku.cpp index 501c872077..29d25e221f 100644 --- a/src/add-ons/kernel/drivers/disk/nvme/compat/libnvme_haiku.cpp +++ b/src/add-ons/kernel/drivers/disk/nvme/compat/libnvme_haiku.cpp @@ -81,10 +81,10 @@ phys_addr_t nvme_mem_vtophys(void* vaddr) { physical_entry entry; - status_t status = get_memory_map((void*)vaddr, 1, &entry, 1); + status_t status = get_memory_map((void*)vaddr, 0, &entry, 1); if (status != B_OK) { - panic("nvme: get_memory_map failed for %p, error %08" B_PRIx32 "\n", - (void*)vaddr, status); + panic("nvme: get_memory_map failed for %p: %s\n", + (void*)vaddr, strerror(status)); return NVME_VTOPHYS_ERROR; }