git: b77bd0e70d2f - stable/14 - freebsd32: Fix freebsd11_nstat copyout condition
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Apr 2026 16:35:26 UTC
The branch stable/14 has been updated by mhorne:
URL: https://cgit.FreeBSD.org/src/commit/?id=b77bd0e70d2ff3d771a53af82348cdde3f399707
commit b77bd0e70d2ff3d771a53af82348cdde3f399707
Author: Weixie Cui <cuiweixie@gmail.com>
AuthorDate: 2026-03-31 10:12:32 +0000
Commit: Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2026-04-16 16:35:00 +0000
freebsd32: Fix freebsd11_nstat copyout condition
freebsd11_freebsd32_nstat() invoked copyout(2) when
freebsd11_cvtnstat32() failed and skipped copyout on success. This is
backwards.
Fix this to match freebsd11_freebsd32_nlstat() and freebsd11_nstat(),
and only copy the nstat32 result to userspace when conversion succeeds.
Signed-off-by: Weixie Cui <cuiweixie@gmail.com>
Reviewed by: mhorne
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/2109
(cherry picked from commit c6224994ac70b4f71ef9e11903bb2e50ed2b1bfe)
---
sys/compat/freebsd32/freebsd32_misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index 9aaca6853859..0d35d1291316 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -2617,7 +2617,7 @@ freebsd11_freebsd32_nstat(struct thread *td,
if (error != 0)
return (error);
error = freebsd11_cvtnstat32(&sb, &nsb);
- if (error != 0)
+ if (error == 0)
error = copyout(&nsb, uap->ub, sizeof (nsb));
return (error);
}