git: fecd8e111a0b - stable/14 - compat_freebsd4: Fix handling of errors from subyte()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 02 Jan 2024 00:37:35 UTC
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=fecd8e111a0bbd4eb4224b2b4821d3097ea9ea00

commit fecd8e111a0bbd4eb4224b2b4821d3097ea9ea00
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-12-26 01:43:38 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-02 00:30:00 +0000

    compat_freebsd4: Fix handling of errors from subyte()
    
    Upon failure, subyte() returns -1, not an errno value.
    
    MFC after:      1 week
    
    (cherry picked from commit c38df501ce2ed7da128448f815ec627c39fd3bad)
---
 sys/kern/kern_xxx.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c
index 398ac18c9422..66d99edb7da1 100644
--- a/sys/kern/kern_xxx.c
+++ b/sys/kern/kern_xxx.c
@@ -367,13 +367,11 @@ freebsd4_uname(struct thread *td, struct freebsd4_uname_args *uap)
 	for(s = version; *s && *s != '#'; s++);
 
 	for(us = uap->name->version; *s && *s != ':'; s++) {
-		error = subyte( us++, *s);
-		if (error)
-			return (error);
+		if (subyte(us++, *s) != 0)
+			return (EFAULT);
 	}
-	error = subyte( us++, 0);
-	if (error)
-		return (error);
+	if (subyte(us++, 0) != 0)
+		return (EFAULT);
 
 	name[0] = CTL_HW;
 	name[1] = HW_MACHINE;