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);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to