svn commit: r313111 - head/sbin/nvmecontrol

Warner Losh imp at FreeBSD.org
Thu Feb 2 23:04:01 UTC 2017


Author: imp
Date: Thu Feb  2 23:04:00 2017
New Revision: 313111
URL: https://svnweb.freebsd.org/changeset/base/313111

Log:
  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.

Modified:
  head/sbin/nvmecontrol/firmware.c

Modified: head/sbin/nvmecontrol/firmware.c
==============================================================================
--- head/sbin/nvmecontrol/firmware.c	Thu Feb  2 23:01:29 2017	(r313110)
+++ head/sbin/nvmecontrol/firmware.c	Thu Feb  2 23:04:00 2017	(r313111)
@@ -114,7 +114,7 @@ update_firmware(int fd, uint8_t *payload
 	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) {


More information about the svn-src-head mailing list