Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Jul 2021 00:21:17 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 26fd09ae5fc4 - stable/12 - Make sure that we get the sbuf resources we need.
Message-ID:  <202107310021.16V0LHZL048796@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=26fd09ae5fc4c1865d7ca15fc33e808c51a8ef52

commit 26fd09ae5fc4c1865d7ca15fc33e808c51a8ef52
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2020-04-30 00:43:11 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-07-31 00:02:51 +0000

    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
    
    (cherry picked from commit 4e6a434b6bb81a7ae80911ec6730ff79b9352a88)
---
 sys/dev/nvme/nvme_ctrlr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
index 18a22aa4f041..a6e2429dbd19 100644
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -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);



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