Commit 72755a709619b1db204c675df8f1093d54e38128
Committed by
Anthony Liguori
1 parent
4bfd1712
qemu/msi: missing braces
MSIX present bit is tested incorrectly, and only happens to work because the bit we are testing is 0x1. Add braces to fix this. Reported-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
1 changed file
with
2 additions
and
1 deletions
hw/msix.c
@@ -286,8 +286,9 @@ void msix_save(PCIDevice *dev, QEMUFile *f) | @@ -286,8 +286,9 @@ void msix_save(PCIDevice *dev, QEMUFile *f) | ||
286 | { | 286 | { |
287 | unsigned n = dev->msix_entries_nr; | 287 | unsigned n = dev->msix_entries_nr; |
288 | 288 | ||
289 | - if (!dev->cap_present & QEMU_PCI_CAP_MSIX) | 289 | + if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) { |
290 | return; | 290 | return; |
291 | + } | ||
291 | 292 | ||
292 | qemu_put_buffer(f, dev->msix_table_page, n * MSIX_ENTRY_SIZE); | 293 | qemu_put_buffer(f, dev->msix_table_page, n * MSIX_ENTRY_SIZE); |
293 | qemu_put_buffer(f, dev->msix_table_page + MSIX_PAGE_PENDING, (n + 7) / 8); | 294 | qemu_put_buffer(f, dev->msix_table_page + MSIX_PAGE_PENDING, (n + 7) / 8); |