x86/ptrace: make genregs[32]_get/set more robust
commit1bb36e83e350d997fb109b77e41bf4dce57ffe58
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 17 Dec 2009 15:04:56 +0000 (17 07:04 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 6 Jan 2010 22:26:44 +0000 (6 14:26 -0800)
tree71b7459a869a0008c6eaf119e5a9c1b350d0a18d
parent2bdc1c6942693c9ab1c17b82bc374966133963f3
x86/ptrace: make genregs[32]_get/set more robust

commit 04a1e62c2cec820501f93526ad1e46073b802dc4 upstream.

The loop condition is fragile: we compare an unsigned value to zero, and
then decrement it by something larger than one in the loop.  All the
callers should be passing in appropriately aligned buffer lengths, but
it's better to just not rely on it, and have some appropriate defensive
loop limits.

Acked-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/kernel/ptrace.c