From c75fcaeef9b22af276694318c1e8df7259cdef7e Mon Sep 17 00:00:00 2001 From: brooks Date: Fri, 19 Jul 2019 23:10:43 +0000 Subject: [PATCH] Remove an unneeded temporary variable in two functions. There is no need to convert an intptr_t to a long just to cast it to a (void *). Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA, AFRL --- lib/libproc/proc_bkpt.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/libproc/proc_bkpt.c b/lib/libproc/proc_bkpt.c index d1a844e8a48..af16877c619 100644 --- a/lib/libproc/proc_bkpt.c +++ b/lib/libproc/proc_bkpt.c @@ -102,7 +102,6 @@ proc_bkptset(struct proc_handle *phdl, uintptr_t address, unsigned long *saved) { struct ptrace_io_desc piod; - unsigned long caddr; int ret = 0, stopped; instr_t instr; @@ -125,10 +124,9 @@ proc_bkptset(struct proc_handle *phdl, uintptr_t address, /* * Read the original instruction. */ - caddr = address; instr = 0; piod.piod_op = PIOD_READ_I; - piod.piod_offs = (void *)caddr; + piod.piod_offs = (void *)address; piod.piod_addr = &instr; piod.piod_len = BREAKPOINT_INSTR_SZ; if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) { @@ -141,10 +139,9 @@ proc_bkptset(struct proc_handle *phdl, uintptr_t address, /* * Write a breakpoint instruction to that address. */ - caddr = address; instr = BREAKPOINT_INSTR; piod.piod_op = PIOD_WRITE_I; - piod.piod_offs = (void *)caddr; + piod.piod_offs = (void *)address; piod.piod_addr = &instr; piod.piod_len = BREAKPOINT_INSTR_SZ; if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) { @@ -167,7 +164,6 @@ proc_bkptdel(struct proc_handle *phdl, uintptr_t address, unsigned long saved) { struct ptrace_io_desc piod; - unsigned long caddr; int ret = 0, stopped; instr_t instr; @@ -189,10 +185,9 @@ proc_bkptdel(struct proc_handle *phdl, uintptr_t address, /* * Overwrite the breakpoint instruction that we setup previously. */ - caddr = address; instr = saved; piod.piod_op = PIOD_WRITE_I; - piod.piod_offs = (void *)caddr; + piod.piod_offs = (void *)address; piod.piod_addr = &instr; piod.piod_len = BREAKPOINT_INSTR_SZ; if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t)&piod, 0) < 0) { -- 2.45.0