x86/ptrace: make genregs[32]_get/set more robust
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 17 Dec 2009 15:04:56 +0000 (07:04 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 6 Jan 2010 23:17:16 +0000 (15:17 -0800)
commit43e1e809a5b7f9bdc65cfd0bdf45675dc7d40fb4
tree5d8f651585968259bc1657fa1ec786da9ab2fd49
parent016b73b363d8d717a37e63c267c0c79d40a6d7d3
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