svn commit: r360485 - head/sys/dev/nvme

Warner Losh imp at FreeBSD.org
Thu Apr 30 00:43:14 UTC 2020


Author: imp
Date: Thu Apr 30 00:43:11 2020
New Revision: 360485
URL: https://svnweb.freebsd.org/changeset/base/360485

Log:
  Make sure that we get the sbuf resources we need.
  
  Since we're calling sbuf_new with NOWAIT, make sure it can allocate a
  buffer to use. Don't print anything if we can't get it.
  
  Noticed by: rpokala

Modified:
  head/sys/dev/nvme/nvme_ctrlr.c

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- head/sys/dev/nvme/nvme_ctrlr.c	Thu Apr 30 00:43:07 2020	(r360484)
+++ head/sys/dev/nvme/nvme_ctrlr.c	Thu Apr 30 00:43:11 2020	(r360485)
@@ -59,7 +59,8 @@ nvme_ctrlr_devctl_log(struct nvme_controller *ctrlr, c
 	va_list ap;
 	int error;
 
-	sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND | SBUF_NOWAIT);
+	if (sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND | SBUF_NOWAIT) == NULL)
+		return;
 	sbuf_printf(&sb, "%s: ", device_get_nameunit(ctrlr->dev));
 	va_start(ap, msg);
 	sbuf_vprintf(&sb, msg, ap);


More information about the svn-src-all mailing list