git: bbfd21cdab7a - stable/13 - Trim duplicate code for copying in iovecs for PT_[GS]ETREGSET.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 12 May 2022 22:56:33 UTC
The branch stable/13 has been updated by jhb:

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

commit bbfd21cdab7ae7b6747c41d3745dfa72362468f6
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-02-07 19:49:29 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-05-12 22:12:59 +0000

    Trim duplicate code for copying in iovecs for PT_[GS]ETREGSET.
    
    Reviewed by:    andrew, emaste
    Differential Revision:  https://reviews.freebsd.org/D34177
    
    (cherry picked from commit 949e3959669f0ca6697ab0d5e8e0b8194de23f81)
---
 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 7c82aebb55c3..177a7bf05ee4 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -986,15 +986,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 fa2617356e30..2876283ce388 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -626,10 +626,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: