git: c2ae37ad0ca9 - stable/13 - freebsd32: Fix error handling for suword32() calls
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 28 Dec 2023 03:11:18 UTC
The branch stable/13 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=c2ae37ad0ca9e77f9ddbdcaf0f3fc6ed4f5a5e53
commit c2ae37ad0ca9e77f9ddbdcaf0f3fc6ed4f5a5e53
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-12-21 16:51:29 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-12-28 03:04:23 +0000
freebsd32: Fix error handling for suword32() calls
suword32() returns -1 upon an error, not an errno value.
MFC after: 1 week
(cherry picked from commit bd1654ce92569bbfbe513749db08cdd781b3a036)
---
sys/compat/freebsd32/freebsd32_capability.c | 5 +++--
sys/compat/freebsd32/freebsd32_misc.c | 5 ++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sys/compat/freebsd32/freebsd32_capability.c b/sys/compat/freebsd32/freebsd32_capability.c
index a5fb8f64a0fd..4a32e996cc75 100644
--- a/sys/compat/freebsd32/freebsd32_capability.c
+++ b/sys/compat/freebsd32/freebsd32_capability.c
@@ -117,9 +117,10 @@ freebsd32_cap_ioctls_get(struct thread *td,
cmds = fdep->fde_ioctls;
if (cmds32 != NULL && cmds != NULL) {
for (i = 0; i < MIN(fdep->fde_nioctls, maxcmds); i++) {
- error = suword32(&cmds32[i], cmds[i]);
- if (error != 0)
+ if (suword32(&cmds32[i], cmds[i]) != 0) {
+ error = EFAULT;
goto out;
+ }
}
}
if (fdep->fde_nioctls == -1)
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index d708efcf91fe..65b7ddf83e3d 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -2568,9 +2568,8 @@ freebsd32___sysctlbyname(struct thread *td,
&oldlen, uap->new, uap->newlen, &rv, SCTL_MASK32, 1);
if (error != 0)
return (error);
- if (uap->oldlenp != NULL)
- error = suword32(uap->oldlenp, rv);
-
+ if (uap->oldlenp != NULL && suword32(uap->oldlenp, rv) != 0)
+ error = EFAULT;
return (error);
}