mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-22 07:37:38 +01:00
Plug in `ARRAY_SIZE' in ptrace code
This commit is contained in:
parent
dcbe6836eb
commit
397f32a378
2 changed files with 4 additions and 4 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue