From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNKEQ-0007No-7f for qemu-devel@nongnu.org; Wed, 03 Apr 2013 05:43:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNKEJ-0003OS-Vk for qemu-devel@nongnu.org; Wed, 03 Apr 2013 05:43:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24070) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNKEJ-0003Ne-MC for qemu-devel@nongnu.org; Wed, 03 Apr 2013 05:43:43 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r339hgqq025496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 3 Apr 2013 05:43:42 -0400 From: Gerd Hoffmann Date: Wed, 3 Apr 2013 11:43:33 +0200 Message-Id: <1364982220-4755-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1364982220-4755-1-git-send-email-kraxel@redhat.com> References: <1364982220-4755-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 03/10] xhci: fix numintrs sanity checks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann 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 --- hw/usb/hcd-xhci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 5aa342b..9d06c51 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; } -- 1.7.9.7