Received: from eggs.gnu.org ([2001:4830:134:3::10]:57559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPr4w-0005Vd-D6 for qemu-devel@nongnu.org; Wed, 20 Jul 2016 08:58:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPr4t-0004lX-Ai for qemu-devel@nongnu.org; Wed, 20 Jul 2016 08:58:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPr4t-0004lI-5H for qemu-devel@nongnu.org; Wed, 20 Jul 2016 08:58:19 -0400 From: Gerd Hoffmann Date: Wed, 20 Jul 2016 14:58:13 +0200 Message-Id: <1469019494-5624-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1469019494-5624-1-git-send-email-kraxel@redhat.com> References: <1469019494-5624-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 1/2] xhci: Fix possible side effect from assert() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , Gerd Hoffmann From: Alexey Kardashevskiy A static analysis tool called BEAM detected possible side effect from assert() calling a helper which may change an XHCI ring after every call. This moves xhci_ring_fetch() out of assert() so it will be called with and without enabled debug. Signed-off-by: Alexey Kardashevskiy Message-id: 1468812548-31868-1-git-send-email-aik@ozlabs.ru Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-xhci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 976bfb0..188f954 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -2201,7 +2201,9 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid, xfer->trb_count = length; for (i = 0; i < length; i++) { - assert(xhci_ring_fetch(xhci, ring, &xfer->trbs[i], NULL)); + TRBType type; + type = xhci_ring_fetch(xhci, ring, &xfer->trbs[i], NULL); + assert(type); } xfer->streamid = streamid; -- 1.8.3.1