git: 3aa79121f2b8 - stable/13 - sendfile: Explicitly ignore errors from copyout()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 02 Jan 2024 01:13:05 UTC
The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3aa79121f2b8cb070ea9b8a89e6ca8ca967a16f5 commit 3aa79121f2b8cb070ea9b8a89e6ca8ca967a16f5 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2023-12-26 01:41:32 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-01-02 01:12:45 +0000 sendfile: Explicitly ignore errors from copyout() There is a documented bug in sendfile.2 which notes that sendfile(2) does not raise an error if it fails to copy out the number of bytes written. Explicitly ignore the error from copyout() calls in preparation for annotating copyout() with __result_use_check. Reviewed by: glebius, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43129 (cherry picked from commit d0adc2f283ad5db6b568ca533a056c9f635551cd) --- sys/compat/freebsd32/freebsd32_misc.c | 2 +- sys/kern/kern_sendfile.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index cd6a4c2dc3df..ee0119dba5af 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -2148,7 +2148,7 @@ freebsd32_do_sendfile(struct thread *td, fdrop(fp, td); if (uap->sbytes != NULL) - copyout(&sbytes, uap->sbytes, sizeof(off_t)); + (void)copyout(&sbytes, uap->sbytes, sizeof(off_t)); out: if (hdr_uio) diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index 8b7a2e7e0ce7..2a34a34067d1 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -1326,7 +1326,7 @@ sendfile(struct thread *td, struct sendfile_args *uap, int compat) fdrop(fp, td); if (uap->sbytes != NULL) - copyout(&sbytes, uap->sbytes, sizeof(off_t)); + (void)copyout(&sbytes, uap->sbytes, sizeof(off_t)); out: free(hdr_uio, M_IOV);