Searched hist:"6725 f887acc023fc8850d62e1aaef083fdb4f3d4" (Results 1 – 1 of 1) sorted by relevance
/openbmc/qemu/util/ |
H A D | hbitmap.c | diff 6725f887acc023fc8850d62e1aaef083fdb4f3d4 Tue Nov 15 16:47:32 CST 2016 Max Reitz <mreitz@redhat.com> hbitmap: Fix shifts of constants by granularity
An hbitmap's granularity may be anything from 0 to 63, so when shifting constants by its value, they should not be plain ints.
Even having changed the types, hbitmap_serialization_granularity() still tries to shift 64 to the right by the granularity. This operation is undefined if the granularity is greater than 57. Adding an assertion is fine for now, because serializing is done only in tests so far, but this means that only bitmaps with a granularity below 58 can be serialized and we should thus add a hbitmap_is_serializable() function later.
One of the two places touched in this patch uses QEMU_ALIGN_UP(x, 1 << y). We can use ROUND_UP() there, since the second parameter is obviously a power of two.
Signed-off-by: Max Reitz <mreitz@redhat.com> Message-Id: <20161115224732.1334-1-mreitz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com>
|