On 01/26/2018 07:17 AM, Richard W.M. Jones wrote:
When compiling on armv7 it becomes clear from the compiler warnings
that the current code is wrong.
The bitmap has to be allocated in virtual memory, so use size_t to
describe the length of the bitmap. When changing the length of the
bitmap, compute the new size as an unsigned 64 bit int, and then check
whether or not it is too large to fit into size_t before casting it.
Indeed, size_t is a sane limit (the only way to get a larger map would
be using an mmap'd file on disk, so that we can use 64-bit off_t instead
of 32-bit size_t). We could also play games with having the granularity
get larger (doubling the size each bit represents lets you cache a
larger disk image). But erroring out for now, and leaving such
enhancements for a future contributor, is fine by me.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization:
qemu.org |
libvirt.org