Date: Wed, 01 Apr 2026 04:34:10 +0000 From: Bjoern A. Zeeb <bz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: d5d08dea8443 - stable/14 - sbuf: make assertion message a lot more useable Message-ID: <69cca042.42717.1fc34f22@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=d5d08dea844315a0f10d8ffefd1c903b3e871c1b commit d5d08dea844315a0f10d8ffefd1c903b3e871c1b Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2026-03-18 14:43:15 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2026-04-01 04:33:47 +0000 sbuf: make assertion message a lot more useable Saying that we are called with an (un)finished or corrupted sbuf is like saying "error" (though [un]finished is an extra hint). Add the pointer to the sbuf so one could easily check it, add the flags we are checking so one could see quickly about a possible state mismatch. Given we already dereference the pointer in the KASSERT there is no extra harm adding it to the message. Found while: testing lindebugfs changes Sponsored by: The FreeBSD Foundation Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D55919 (cherry picked from commit 2ce06d25431a6c96ef5719165cb73e138a0ed89c) (cherry picked from commit 40be04834308e3aa1e1cf411f87f16a34f4ff130) --- sys/kern/subr_sbuf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c index 0ce2427f6dbb..002b65d81959 100644 --- a/sys/kern/subr_sbuf.c +++ b/sys/kern/subr_sbuf.c @@ -125,8 +125,8 @@ _assert_sbuf_state(const char *fun, struct sbuf *s, int state) { KASSERT((s->s_flags & SBUF_FINISHED) == state, - ("%s called with %sfinished or corrupt sbuf", fun, - (state ? "un" : ""))); + ("%s called with %sfinished or corrupt sbuf %p { s_flags %#010x }, " + "state %#010x", fun, (state ? "un" : ""), s, s->s_flags, state)); } #define assert_sbuf_integrity(s) _assert_sbuf_integrity(__func__, (s))home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69cca042.42717.1fc34f22>
