Date: Sun, 19 Feb 2023 05:47:14 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 071a0b5b7058 - stable/13 - allocbuf(): convert direct panic() calls to KASSERT()s Message-ID: <202302190547.31J5lEXj097124@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=071a0b5b7058b97b629e6aa49e7d03bb87615f5f commit 071a0b5b7058b97b629e6aa49e7d03bb87615f5f Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-02-11 18:03:22 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-02-19 05:16:25 +0000 allocbuf(): convert direct panic() calls to KASSERT()s (cherry picked from commit 020e8a4d0609d56cb49a9f35258ff07815d5e478) --- sys/kern/vfs_bio.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index abb9ebc7281b..6a479ed335ef 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -4343,8 +4343,9 @@ allocbuf(struct buf *bp, int size) if (bp->b_bcount == size) return (1); - if (bp->b_kvasize != 0 && bp->b_kvasize < size) - panic("allocbuf: buffer too small"); + KASSERT(bp->b_kvasize == 0 || bp->b_kvasize >= size, + ("allocbuf: buffer too small %p %#x %#x", + bp, bp->b_kvasize, size)); newbsize = roundup2(size, DEV_BSIZE); if ((bp->b_flags & B_VMIO) == 0) { @@ -4361,11 +4362,12 @@ allocbuf(struct buf *bp, int size) } else { int desiredpages; - desiredpages = (size == 0) ? 0 : + desiredpages = size == 0 ? 0 : num_pages((bp->b_offset & PAGE_MASK) + newbsize); - if (bp->b_flags & B_MALLOC) - panic("allocbuf: VMIO buffer can't be malloced"); + KASSERT((bp->b_flags & B_MALLOC) == 0, + ("allocbuf: VMIO buffer can't be malloced %p", bp)); + /* * Set B_CACHE initially if buffer is 0 length or will become * 0-length.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302190547.31J5lEXj097124>