freebsd32: Fix error handling for suword32() calls

suword32() returns -1 upon an error, not an errno value.

MFC after:	1 week
This commit is contained in:
Mark Johnston 2023-12-21 11:51:29 -05:00
parent 3d36053ca6
commit bd1654ce92
2 changed files with 5 additions and 5 deletions

View File

@ -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)

View File

@ -2700,9 +2700,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);
}