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
This commit is contained in:
Warner Losh 2020-04-30 00:43:11 +00:00
parent 2446ce7a63
commit 4e6a434b6b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=360485

View File

@ -59,7 +59,8 @@ nvme_ctrlr_devctl_log(struct nvme_controller *ctrlr, const char *type, const cha
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);