kvm-all: Use 'tmpcpu' instead of 'cpu' in sub-looping to avoid 'cpu' be NULL
commit046e3573799e4d09f34353cd5a3bce2c597d5c3c
authorChen Gang <gang.chen.5i5j@gmail.com>
Sat, 19 Jul 2014 01:21:46 +0000 (19 09:21 +0800)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 6 Aug 2014 19:55:49 +0000 (6 14:55 -0500)
tree46460063ee69ee5a392e9ac16f51c3f7ca9da073
parentb1251db2583adfcb5e3b12ee1d9b32f415746056
kvm-all: Use 'tmpcpu' instead of 'cpu' in sub-looping to avoid 'cpu' be NULL

If kvm_arch_remove_sw_breakpoint() in CPU_FOREACH() always be fail, it
will let 'cpu' NULL. And the next kvm_arch_remove_sw_breakpoint() in
QTAILQ_FOREACH_SAFE() will get NULL parameter for 'cpu'.

And kvm_arch_remove_sw_breakpoint() can assumes 'cpu' must never be NULL,
so need define additional temporary variable for 'cpu' to avoid the case.

Cc: qemu-stable@nongnu.org
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit dc54e2525389e903cee2b847cf761b5d857f75cb)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
kvm-all.c