nutanix / libvfio-user

framework for emulating devices in userspace
BSD 3-Clause "New" or "Revised" License
154 stars 49 forks source link

fix: incorrect number of dirty pages printed #766

Closed w-henderson closed 11 months ago

w-henderson commented 11 months ago

The log_dirty_bitmap function in dma.c would output the wrong number of dirty pages due to the char of the bitmap being sign-extended when implicitly being converted to unsigned int for __builtin_popcount. By adding an intermediate cast to uint8_t we avoid this incorrect behaviour.

See https://github.com/nutanix/libvfio-user/pull/746#discussion_r1297173318.

jlevon commented 11 months ago

can you force push to correct the commit message too, including your paragraph explanation above?