git: 949e3959669f - main - Trim duplicate code for copying in iovecs for PT_[GS]ETREGSET.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 07 Feb 2022 19:52:40 UTC
The branch main has been updated by jhb:

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

commit 949e3959669f0ca6697ab0d5e8e0b8194de23f81
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-02-07 19:49:29 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-02-07 19:49:29 +0000

    Trim duplicate code for copying in iovecs for PT_[GS]ETREGSET.
    
    Reviewed by:    andrew, emaste
    Differential Revision:  https://reviews.freebsd.org/D34177
---
 sys/compat/freebsd32/freebsd32_misc.c | 9 +--------
 sys/kern/sys_process.c                | 4 +---
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index 790f2597b75f..01337ea51c50 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -1026,15 +1026,8 @@ freebsd32_ptrace(struct thread *td, struct freebsd32_ptrace_args *uap)
 	case PT_SETDBREGS:
 		error = copyin(uap->addr, &r.dbreg, sizeof(r.dbreg));
 		break;
-	case PT_SETREGSET:
-		error = copyin(uap->addr, &r32.vec, sizeof(r32.vec));
-		if (error != 0)
-			break;
-
-		r.vec.iov_len = r32.vec.iov_len;
-		r.vec.iov_base = PTRIN(r32.vec.iov_base);
-		break;
 	case PT_GETREGSET:
+	case PT_SETREGSET:
 		error = copyin(uap->addr, &r32.vec, sizeof(r32.vec));
 		if (error != 0)
 			break;
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index fc4cd897fcba..582bff962f1a 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -627,10 +627,8 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap)
 	case PT_GETDBREGS:
 		bzero(&r.dbreg, sizeof(r.dbreg));
 		break;
-	case PT_SETREGSET:
-		error = copyin(uap->addr, &r.vec, sizeof(r.vec));
-		break;
 	case PT_GETREGSET:
+	case PT_SETREGSET:
 		error = copyin(uap->addr, &r.vec, sizeof(r.vec));
 		break;
 	case PT_SETREGS: