Skip to content

Commit 99512ae

Browse files
chenhuacaijfvogel
authored andcommitted
LoongArch: Fix MAX_REG_OFFSET calculation
commit 90436d234230e9a950ccd87831108b688b27a234 upstream. Fix MAX_REG_OFFSET calculation, make it point to the last register in 'struct pt_regs' and not to the marker itself, which could allow regs_get_register() to return an invalid offset. Cc: [email protected] Fixes: 803b0fc ("LoongArch: Add process management") Signed-off-by: Huacai Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit c92b99c4c0977c4e935a24918310f1fb8311b178) Signed-off-by: Jack Vogel <[email protected]>
1 parent bdb3716 commit 99512ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/loongarch/include/asm/ptrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static inline void instruction_pointer_set(struct pt_regs *regs, unsigned long v
5555

5656
/* Query offset/name of register from its name/offset */
5757
extern int regs_query_register_offset(const char *name);
58-
#define MAX_REG_OFFSET (offsetof(struct pt_regs, __last))
58+
#define MAX_REG_OFFSET (offsetof(struct pt_regs, __last) - sizeof(unsigned long))
5959

6060
/**
6161
* regs_get_register() - get register value from its offset

0 commit comments

Comments
 (0)