Use aligned buffer for the firmware data. Otherwise, when loading a

MAXPHYS bytes of data, the I/O would require MAXPHYS + PAGE_SIZE worth
of pages to do the I/O and we'd hit an assertion in
vm_fault_quick_hold_pages unless MAXPHYS was larger than 1M +
PAGE_SIZE.
This commit is contained in:
Warner Losh 2017-02-02 23:04:00 +00:00
parent 9c16356ccd
commit dc935c4f19
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=313111

View File

@ -114,7 +114,7 @@ update_firmware(int fd, uint8_t *payload, int32_t payload_size)
off = 0;
resid = payload_size;
if ((chunk = malloc(NVME_MAX_XFER_SIZE)) == NULL)
if ((chunk = aligned_alloc(NVME_MAX_XFER_SIZE, PAGE_SIZE)) == NULL)
errx(1, "unable to malloc %d bytes", NVME_MAX_XFER_SIZE);
while (resid > 0) {