Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Aug 2025 13:55:21 GMT
From:      Maxim Sobolev <sobomax@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c73d3c6c960b - stable/14 - mbuf: improve KASSERT(9) falure messages in the m_apply()
Message-ID:  <202508281355.57SDtLfW040544@gitrepo.freebsd.org>

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

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

commit c73d3c6c960bef6222fa03a1119df0bb5380a611
Author:     Maxim Sobolev <sobomax@FreeBSD.org>
AuthorDate: 2024-09-10 01:51:05 +0000
Commit:     Maxim Sobolev <sobomax@FreeBSD.org>
CommitDate: 2025-08-28 13:54:34 +0000

    mbuf: improve KASSERT(9) falure messages in the m_apply()
    
    - Make less ambiguous;
    - extend to provide more context for post-mortem.
    
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D43776
    MFC after:      2 weeks
    
    (cherry picked from commit a43fb3653b35ab88b72e1277dccc26328363cdb7)
---
 sys/kern/uipc_mbuf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index b10e524e6e4b..1ce049014711 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1375,14 +1375,16 @@ m_apply(struct mbuf *m, int off, int len,
 	KASSERT(off >= 0, ("m_apply, negative off %d", off));
 	KASSERT(len >= 0, ("m_apply, negative len %d", len));
 	while (off > 0) {
-		KASSERT(m != NULL, ("m_apply, offset > size of mbuf chain"));
+		KASSERT(m != NULL, ("m_apply, offset > size of mbuf chain "
+		    "(%d extra)", off));
 		if (off < m->m_len)
 			break;
 		off -= m->m_len;
 		m = m->m_next;
 	}
 	while (len > 0) {
-		KASSERT(m != NULL, ("m_apply, offset > size of mbuf chain"));
+		KASSERT(m != NULL, ("m_apply, length > size of mbuf chain "
+		    "(%d extra)", len));
 		count = min(m->m_len - off, len);
 		rval = m_apply_one(m, off, count, f, arg);
 		if (rval)



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