diff --git a/src/ptrace/_UPT_access_fpreg.c b/src/ptrace/_UPT_access_fpreg.c index 283dcd4f..40143775 100644 --- a/src/ptrace/_UPT_access_fpreg.c +++ b/src/ptrace/_UPT_access_fpreg.c @@ -36,7 +36,7 @@ _UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, pid_t pid = ui->pid; int i; - if ((unsigned) reg >= sizeof (_UPT_reg_offset) / sizeof (_UPT_reg_offset[0])) + if ((unsigned) reg >= ARRAY_SIZE (_UPT_reg_offset)) return -UNW_EBADREG; errno = 0; @@ -75,7 +75,7 @@ _UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, pid_t pid = ui->pid; fpregset_t fpreg; - if ((unsigned) reg >= sizeof (_UPT_reg_offset) / sizeof (_UPT_reg_offset[0])) + if ((unsigned) reg >= ARRAY_SIZE (_UPT_reg_offset)) return -UNW_EBADREG; if (ptrace(PT_GETFPREGS, pid, (caddr_t)&fpreg, 0) == -1) diff --git a/src/ptrace/_UPT_access_reg.c b/src/ptrace/_UPT_access_reg.c index ed259d82..782eeb70 100644 --- a/src/ptrace/_UPT_access_reg.c +++ b/src/ptrace/_UPT_access_reg.c @@ -225,7 +225,7 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, } #endif /* End of IA64 */ - if ((unsigned) reg >= sizeof (_UPT_reg_offset) / sizeof (_UPT_reg_offset[0])) + if ((unsigned) reg >= ARRAY_SIZE (_UPT_reg_offset)) { #if UNW_DEBUG Debug(2, "register out of range: >= %zu / %zu\n", sizeof(_UPT_reg_offset), sizeof(_UPT_reg_offset[0])); @@ -284,7 +284,7 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, if (write) Debug (16, "%s [%u] <- %lx\n", unw_regname (reg), (unsigned) reg, (long) *val); #endif - if ((unsigned) reg >= sizeof (_UPT_reg_offset) / sizeof (_UPT_reg_offset[0])) + if ((unsigned) reg >= ARRAY_SIZE (_UPT_reg_offset)) { errno = EINVAL; goto badreg;