Skip to content

Commit eaa30e1

Browse files
tobluxgregkh
authored andcommitted
MIPS: Fix MAX_REG_OFFSET
[ Upstream commit c44572e ] Fix MAX_REG_OFFSET to point to the last register in 'pt_regs' and not to the marker itself, which could allow regs_get_register() to return an invalid offset. Fixes: 40e084a ("MIPS: Add uprobes support.") Suggested-by: Maciej W. Rozycki <[email protected]> Signed-off-by: Thorsten Blum <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent fb98c9e commit eaa30e1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/mips/include/asm/ptrace.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ static inline void instruction_pointer_set(struct pt_regs *regs,
6565

6666
/* Query offset/name of register from its name/offset */
6767
extern int regs_query_register_offset(const char *name);
68-
#define MAX_REG_OFFSET (offsetof(struct pt_regs, __last))
68+
#define MAX_REG_OFFSET \
69+
(offsetof(struct pt_regs, __last) - sizeof(unsigned long))
6970

7071
/**
7172
* regs_get_register() - get register value from its offset

0 commit comments

Comments
 (0)