h8300/ptrace: Fix incorrect register transfer count
authorDave Martin <Dave.Martin@arm.com>
Mon, 27 Mar 2017 14:10:54 +0000 (15:10 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 29 Mar 2017 15:54:17 +0000 (08:54 -0700)
commit502585c7555083d4a949c08350306b9ec196779e
treeceadf8d793ceaae32940754291fbd056a7cfa2ce
parentfb411b837b587a32046dc4f369acb93a10b1def8
h8300/ptrace: Fix incorrect register transfer count

regs_set() and regs_get() are vulnerable to an off-by-1 buffer overrun
if CONFIG_CPU_H8S is set, since this adds an extra entry to
register_offset[] but not to user_regs_struct.

So, iterate over user_regs_struct based on its actual size, not based on
the length of register_offset[].

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/h8300/kernel/ptrace.c