aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-07-08 14:54:25 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-07-08 17:01:09 +0000
commitb72397da275b098365532133688d555b842bad4f (patch)
treeec3cfc565a870fe42ea377de7877ac40811187a7
parented7e0ebfa20e7e798d2e4e20623d452f1c715aa5 (diff)
kern_filewrite(): unconditionally calculate cnt, it is used by callers
Reported by: dhw, madpilot Tested by: dhw Sponsored by: The FreeBSD Foundation MFC after: 1 week Fixes: dfad790c8cca ("sendfile: stop abusing kern_writev()")
-rw-r--r--sys/kern/sys_generic.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 079bd7b347d7..d5145d6cf322 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -595,9 +595,9 @@ kern_filewrite(struct thread *td, int fd, struct file *fp, struct uio *auio,
#endif
cnt = auio->uio_resid;
error = fo_write(fp, auio, td->td_ucred, flags, td);
+ cnt -= auio->uio_resid;
#ifdef KTRACE
if (ktruio != NULL) {
- cnt -= auio->uio_resid;
if (error == 0)
ktruio->uio_resid = cnt;
ktrgenio(fd, UIO_WRITE, ktruio, error);