diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2013-03-19 09:18:20 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2013-04-03 09:55:49 +0200 |
commit | c94a7c6979cafa7a71f32b35e0ff71ed00c61a89 (patch) | |
tree | 68001dd495a66a289ed67973a380b335b1ea0d18 /hw/usb/hcd-xhci.c | |
parent | c874ea97b9d0d079e9d65ef033b95afef0ed6532 (diff) | |
download | qemu-c94a7c6979cafa7a71f32b35e0ff71ed00c61a89.zip |
xhci: fix numintrs sanity checks
Make sure numintrs is a power of two, msi requires this.
https://bugzilla.redhat.com/show_bug.cgi?id=918035
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/hcd-xhci.c')
-rw-r--r-- | hw/usb/hcd-xhci.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 5aa342bda5..9d06c51f9c 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -3290,6 +3290,9 @@ static int usb_xhci_initfn(struct PCIDevice *dev) if (xhci->numintrs > MAXINTRS) { xhci->numintrs = MAXINTRS; } + while (xhci->numintrs & (xhci->numintrs - 1)) { /* ! power of 2 */ + xhci->numintrs++; + } if (xhci->numintrs < 1) { xhci->numintrs = 1; } |