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
This commit is contained in:
Weixie Cui
2026-03-31 18:12:32 +08:00
committed by Mitchell Horne
parent f86ba3eec5
commit c6224994ac
+1 -1
View File
@@ -2649,7 +2649,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);
}