The following reply was made to PR kern/163076; it has been noted by GNATS.
From: Jaakko Heinonen <[email protected]> To: Poul-Henning Kamp <[email protected]> Cc: Petr Salinger <[email protected]>, [email protected] Subject: Re: kern/163076: It is not possible to read in chunks from linprocfs and procfs. Date: Tue, 6 Dec 2011 15:21:36 +0200 On 2011-12-06, Poul-Henning Kamp wrote: > >Shouldn't sbuf_finish() then check s->s_error before appending the > >trailing '\0' and setting the SBUF_FINISHED flag? The problem in > >question wasn't caught earlier because sbuf_finish() happily finishes > >the buffer even if it has an error. > > I belive the code is written so that there is always reserved space > for the final '\0' > > sbuf_finish() should finish _any_ sbuf, and return zero only if > the finished buffer is fully OK. Anyway I find it inconsistent that you can successfully call sbuf_finish() and sbuf_data() but not for example sbuf_len() on an errored buffer. Thus you can "fix" the problem with the subtle change below. %%% Index: sys/fs/pseudofs/pseudofs_vnops.c =================================================================== --- sys/fs/pseudofs/pseudofs_vnops.c (revision 228153) +++ sys/fs/pseudofs/pseudofs_vnops.c (working copy) @@ -651,7 +651,7 @@ pfs_read(struct vop_read_args *va) } sbuf_finish(sb); - error = uiomove_frombuf(sbuf_data(sb), sbuf_len(sb), uio); + error = uiomove_frombuf(sbuf_data(sb), strlen(sbuf_data(sb)), uio); sbuf_delete(sb); ret: vn_lock(vn, locked | LK_RETRY); %%% -- Jaakko _______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "[email protected]"
