Skip to content

Commit

Permalink
LoongArch: Fix MAX_REG_OFFSET calculation
Browse files Browse the repository at this point in the history
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: stable@vger.kernel.org
Fixes: 803b0fc ("LoongArch: Add process management")
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
  • Loading branch information
Huacai Chen committed May 14, 2025
1 parent 2468b0e commit 90436d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/loongarch/include/asm/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static inline void instruction_pointer_set(struct pt_regs *regs, unsigned long v

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

/**
* regs_get_register() - get register value from its offset
Expand Down

0 comments on commit 90436d2

Please sign in to comment.