git: 81ee40d0a269 - stable/14 - compat_freebsd4: Check for errors from subyte() in freebsd4_uname()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 02 Jan 2024 00:37:17 UTC
The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=81ee40d0a269f8fb902f79b9e6f018944880ac8f commit 81ee40d0a269f8fb902f79b9e6f018944880ac8f Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2023-12-26 01:39:21 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-01-02 00:29:47 +0000 compat_freebsd4: Check for errors from subyte() in freebsd4_uname() This is in preparation for adding a __result_use_check annotation to copyin() and related functions. Reviewed by: imp, kib, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43099 (cherry picked from commit 4f35450ce52a7b141e7ae8d37fa257b5f8971dda) --- sys/kern/kern_xxx.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c index 3fe681d0c08e..398ac18c9422 100644 --- a/sys/kern/kern_xxx.c +++ b/sys/kern/kern_xxx.c @@ -327,7 +327,9 @@ freebsd4_uname(struct thread *td, struct freebsd4_uname_args *uap) 1, 0, 0, 0, 0); if (error) return (error); - subyte( uap->name->sysname + sizeof(uap->name->sysname) - 1, 0); + error = subyte(uap->name->sysname + sizeof(uap->name->sysname) - 1, 0); + if (error) + return (EFAULT); name[1] = KERN_HOSTNAME; len = sizeof uap->name->nodename; @@ -335,7 +337,9 @@ freebsd4_uname(struct thread *td, struct freebsd4_uname_args *uap) 1, 0, 0, 0, 0); if (error) return (error); - subyte( uap->name->nodename + sizeof(uap->name->nodename) - 1, 0); + error = subyte(uap->name->nodename + sizeof(uap->name->nodename) - 1, 0); + if (error) + return (EFAULT); name[1] = KERN_OSRELEASE; len = sizeof uap->name->release; @@ -343,7 +347,9 @@ freebsd4_uname(struct thread *td, struct freebsd4_uname_args *uap) 1, 0, 0, 0, 0); if (error) return (error); - subyte( uap->name->release + sizeof(uap->name->release) - 1, 0); + error = subyte(uap->name->release + sizeof(uap->name->release) - 1, 0); + if (error) + return (EFAULT); /* name = KERN_VERSION; @@ -376,7 +382,9 @@ freebsd4_uname(struct thread *td, struct freebsd4_uname_args *uap) 1, 0, 0, 0, 0); if (error) return (error); - subyte( uap->name->machine + sizeof(uap->name->machine) - 1, 0); + error = subyte(uap->name->machine + sizeof(uap->name->machine) - 1, 0); + if (error) + return (EFAULT); return (0); }