KVM: fix the handling of dirty bitmaps to avoid overflows
commitff5bfd4f4896c3f27dafcc4ae533b0d803968499
authorTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Mon, 12 Apr 2010 10:35:35 +0000 (12 19:35 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 26 Apr 2010 14:48:05 +0000 (26 07:48 -0700)
tree06ff00917d803d3112ec379d3b75ad2e778a8afc
parentf1f52e1094fc4e39bfd3071e33803fbbf0543d49
KVM: fix the handling of dirty bitmaps to avoid overflows

(Cherry-picked from commit 87bf6e7de1134f48681fd2ce4b7c1ec45458cb6d)

Int is not long enough to store the size of a dirty bitmap.

This patch fixes this problem with the introduction of a wrapper
function to calculate the sizes of dirty bitmaps.

Note: in mark_page_dirty(), we have to consider the fact that
  __set_bit() takes the offset as int, not long.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/ia64/kvm/kvm-ia64.c
arch/powerpc/kvm/book3s.c
arch/x86/kvm/x86.c
include/linux/kvm_host.h
virt/kvm/kvm_main.c