Message ID | 1374763357-4893-3-git-send-email-ben.dooks@codethink.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index cb67b04..ae2d828 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -344,15 +344,17 @@ void arm_notify_die(const char *str, struct pt_regs *regs, int is_valid_bugaddr(unsigned long pc) { #ifdef CONFIG_THUMB2_KERNEL - unsigned short bkpt; + u16 bkpt; + u16 insn = __opcode_to_mem_thumb16(BUG_INSTR_VALUE); #else - unsigned long bkpt; + u32 bkpt; + u32 insn = __opcode_to_mem_arm(BUG_INSTR_VALUE); #endif if (probe_kernel_address((unsigned *)pc, bkpt)) return 0; - return bkpt == BUG_INSTR_VALUE; + return bkpt == insn; } #endif
The detection of the instruction used by BUG() did not take into account the differences in endian-ness between instruction and data. Change the code to use the relevant helpers in <asm/opcodes.h> to translate the endian-ness of the instructions. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> --- arch/arm/kernel/traps.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)