Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Feb 2017 23:04:00 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r313111 - head/sbin/nvmecontrol
Message-ID:  <201702022304.v12N409c035434@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702022304.v12N409c035434>