git: c38df501ce2e - main - compat_freebsd4: Fix handling of errors from subyte()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 26 Dec 2023 02:04:35 UTC
The branch main has been updated by markj:

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

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

    compat_freebsd4: Fix handling of errors from subyte()
    
    Upon failure, subyte() returns -1, not an errno value.
    
    MFC after:      1 week
---
 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 e8331a5cdb1f..46155cf6a73e 100644
--- a/sys/kern/kern_xxx.c
+++ b/sys/kern/kern_xxx.c
@@ -364,13 +364,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;