Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Mar 2026 16:10:14 +0000
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: c181c8f5ca70 - main - LinuxKPI: Clear the sbuf at the start of each call to seq_read
Message-ID:  <69b97ce6.1c815.533d9763@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by jhb:

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

commit c181c8f5ca707962359e636ca5aa536e60147eee
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-03-17 16:05:17 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-03-17 16:05:17 +0000

    LinuxKPI: Clear the sbuf at the start of each call to seq_read
    
    Each invocation of seq_read invokes the seq_file.show callback which
    writes into the sbuf.  Then it invokes sbuf_finish before copying the
    data into the caller's buffer.  Without this, a second call to
    seq_read on the same file would try to append data to a finished sbuf.
    
    Reviewed by:    bz
    Sponsored by:   AFRL, DARPA
---
 sys/compat/linuxkpi/common/src/linux_seq_file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/compat/linuxkpi/common/src/linux_seq_file.c b/sys/compat/linuxkpi/common/src/linux_seq_file.c
index 9c06fe27bebe..6fe6ccd1e68e 100644
--- a/sys/compat/linuxkpi/common/src/linux_seq_file.c
+++ b/sys/compat/linuxkpi/common/src/linux_seq_file.c
@@ -49,6 +49,7 @@ seq_read(struct linux_file *f, char *ubuf, size_t size, off_t *ppos)
 
 	m = f->private_data;
 	sbuf = m->buf;
+	sbuf_clear(sbuf);
 
 	p = m->op->start(m, ppos);
 	rc = m->op->show(m, p);


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69b97ce6.1c815.533d9763>