From: Gerd Hoffmann Date: Tue, 19 Mar 2013 08:18:20 +0000 (+0100) Subject: xhci: fix numintrs sanity checks X-Git-Tag: v1.5.0-rc0~319^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c94a7c6979cafa7a71f32b35e0ff71ed00c61a89;p=thirdparty%2Fqemu.git 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 --- diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 5aa342bda5a..9d06c51f9c5 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; }