x86/ptrace: make genregs[32]_get/set more robust
commitb52d85562809f1e8b03d03f6ebc5aa28405d0576
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 23:04:35 +0000 (6 15:04 -0800)
tree5ef36f2f0d8a9dda541d24e3248adcf838893891
parent6e2aa7de04f48bd39955fe0939dc2e02b8941839
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