nvme: Initialize HMB entries before loading them into the controller

struct nvme_hmb_desc contains a pad field which was not getting
initialized before being synced.  This doesn't have much consequence but
triggers a report from KMSAN, which verifies that host-filled DMA memory
is initialized before it is made visible to the device.  So, let's just
initialize it properly.

Reported by:	KMSAN
Reviewed by:	mav, imp
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D43090
This commit is contained in:
Mark Johnston 2023-12-18 17:45:24 -05:00
parent 8a1b84f861
commit d9b7301bb7

View file

@ -1007,6 +1007,8 @@ nvme_ctrlr_hmb_alloc(struct nvme_controller *ctrlr)
}
for (i = 0; i < ctrlr->hmb_nchunks; i++) {
memset(&ctrlr->hmb_desc_vaddr[i], 0,
sizeof(struct nvme_hmb_desc));
ctrlr->hmb_desc_vaddr[i].addr =
htole64(ctrlr->hmb_chunks[i].hmbc_paddr);
ctrlr->hmb_desc_vaddr[i].size = htole32(ctrlr->hmb_chunk / ctrlr->page_size);