Received: from eggs.gnu.org ([2001:4830:134:3::10]:40741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOzFj-0002qr-GW for qemu-devel@nongnu.org; Sun, 17 Jul 2016 23:29:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bOzFg-0002nU-8b for qemu-devel@nongnu.org; Sun, 17 Jul 2016 23:29:55 -0400 Received: from ozlabs.ru ([83.169.36.222]:46571) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOzFg-0002nH-27 for qemu-devel@nongnu.org; Sun, 17 Jul 2016 23:29:52 -0400 From: Alexey Kardashevskiy Date: Mon, 18 Jul 2016 13:29:08 +1000 Message-Id: <1468812548-31868-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH qemu] 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 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 --- 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; -- 2.5.0.rc3