Skip to content

Commit 8d23de9

Browse files
tobluxvijay-suman
authored andcommitted
MIPS: Fix MAX_REG_OFFSET
[ Upstream commit c44572e0cc13c9afff83fd333135a0aa9b27ba26 ] 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]> (cherry picked from commit aba591c13ba4585a473b78856ff2d52a22d9074e) Signed-off-by: Vijayendra Suman <[email protected]>
1 parent 3a61757 commit 8d23de9

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)