ARM: 6767/1: ptrace: fix register indexing in GETHBPREGS request

The GETHBPREGS ptrace request incorrectly maps its index argument onto
the thread's saved debug state when the index != 0. This has not yet
been seen from userspace because GDB (the only user of this request)
only reads from register 0.

This patch fixes the indexing.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by Will Deacon and committed by Russell King ba55d3db 8f311270

+3 -3
+3 -3
arch/arm/kernel/ptrace.c
··· 996 996 while (!(arch_ctrl.len & 0x1)) 997 997 arch_ctrl.len >>= 1; 998 998 999 - if (idx & 0x1) 1000 - reg = encode_ctrl_reg(arch_ctrl); 1001 - else 999 + if (num & 0x1) 1002 1000 reg = bp->attr.bp_addr; 1001 + else 1002 + reg = encode_ctrl_reg(arch_ctrl); 1003 1003 } 1004 1004 1005 1005 put: