Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Apr 2020 00:43:12 +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: r360485 - head/sys/dev/nvme
Message-ID:  <202004300043.03U0hCt1032830@repo.freebsd.org>

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



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