git: d0adc2f283ad - main - sendfile: Explicitly ignore errors from copyout()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 26 Dec 2023 02:04:23 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d0adc2f283ad5db6b568ca533a056c9f635551cd commit d0adc2f283ad5db6b568ca533a056c9f635551cd Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2023-12-26 01:41:32 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2023-12-26 02:04:00 +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 --- 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 41f456d67e5b..f2d66cf74b2b 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -2195,7 +2195,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 dfdf01f45e34..f6f6b57adfc7 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -1328,7 +1328,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);