From patchwork Tue Apr 7 15:22:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 185239 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp4982633ilr; Tue, 7 Apr 2020 08:23:32 -0700 (PDT) X-Google-Smtp-Source: APiQypIBLuLh7yoLzEwQfXURCB9TztwGdeVZe/KvxjCF3dDBVQa6Vx6ctWR5Op5sEle/UVLADkQQ X-Received: by 2002:a37:8741:: with SMTP id j62mr2601368qkd.441.1586273011977; Tue, 07 Apr 2020 08:23:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586273011; cv=none; d=google.com; s=arc-20160816; b=LquWkpreSM5H3c3IKLDadeSPnwvsMN4vX4CQgzTAe8gz5zKvLBzYKnlJlgvhVnjrz1 iA1J6NpYi6LhSlcU7AvhnABpvjW9y2zc/Foo+kfL0vnCTj6ymlcpoO4dqXk66T89VxpH GQMwtl+w53970lDIY+fYWPFWKczhD/ehfL7/VYCBKttmGuUGZgv9tjmVKcSAZ3LEVXLE 7jTJ3ZK8gNxkyzQPrsMWoSUFc+BjZzoq+Vej/6BA9+W97e3aMQK4/UGZi61i4UV1dkn3 tnJX0v+y4oTdf8Cy6gbEmv32WMXDCpUf+SeV4kNz5/S+GwR+KadXE8Be5fIUxvOWDWCY NCeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :ironport-sdr:dkim-signature; bh=7iduL9fzS8EYAdm7BBPzK9c8Jm5ZihuT3droxcJ6+p0=; b=rZrD0rt07VPupXliaxGMxapK1OYhcJDWChFOAbXfQkpt3yMtGOT2F3r2IUAv+D2/Zw 4AO42XPQ8M1nxLbyTgruEEs5LPPV/tBcyt1l1KeqBHDLC+Cyp36GJM+RzUV+jsKjYuJo pYq4xA4dkBiYrK3ueOvFB+YP3QvhWo09Z/3wTsvGrudpxL+K2x+ZU5wW6oB6rANUyy5v ISufJ1X4k6kx/F6EBu/x6W9B2SGxPWPl0N77n/5OJfs+siE3kspLVlPWS3Kz7LBBfm09 KXBesABieEw0TW5Rho6prdphb+SpXgEOHnLk9ohYhBdUnr6lxybwDGiK8SW+cchyoNjF ektA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b=GgoZGmKK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=citrix.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c21si1989361qte.256.2020.04.07.08.23.31 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Apr 2020 08:23:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b=GgoZGmKK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=citrix.com Received: from localhost ([::1]:49164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLq4Z-0008H7-HN for patch@linaro.org; Tue, 07 Apr 2020 11:23:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38759) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLq42-0008D7-9N for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:22:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLq41-0000VR-8g for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:22:58 -0400 Received: from esa1.hc3370-68.iphmx.com ([216.71.145.142]:13489) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLq40-0000TJ-Sf for qemu-devel@nongnu.org; Tue, 07 Apr 2020 11:22:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1586272977; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qk1Y4jepw5ZUFH8O7s3prQyFWb+r4UOxrpJ04Jwz6vo=; b=GgoZGmKK8TkTo9wAHfUFKoEhYh/MDrfWcpPNJ1Y1JIrfmIqy8rvZHY6u tDz9e0Zt3WTw0El01IYb5I6lf/dU8Kg4GAtR8ANDISHSNhpdNtDjL51Be 1aPnNz1EtCJYRY/0RaJjs3A5Bie29mmW5vJPCeCDNnXTysbMZT7Q//di9 4=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=anthony.perard@citrix.com; spf=Pass smtp.mailfrom=anthony.perard@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: uJfw3vKfJcYjs2uYVUJY2Vqq4/96T8V+v/wBgcIrMvNqvt5u1WxRVXNo6wLv9KOa+i4hoW+dp1 nvxF367qo1JJakgKbTVrvv124fXRlU1hiM1DezCI8AD65BnARTYJPyEmjXkdZgyRbUAPLfm430 /CqeFeUgiyHOPAsksTFtT24nF7GshbMxRELlvxmk1s+L6BEaASJLDYHTQE2n+Y7VatC/LvrAG/ BpEnnGqdJeavXRQqX6usRCNYpETrfT8sLyjQPmM533ZTEbdhPsXW4syivaAfud+3Jo0h/T81q/ KP4= X-SBRS: 2.7 X-MesageID: 15534900 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,355,1580792400"; d="scan'208";a="15534900" From: Anthony PERARD To: Subject: [PULL 1/3] hw/usb/xen-usb.c: Pass struct usbback_req* to usbback_packet_complete() Date: Tue, 7 Apr 2020 16:22:35 +0100 Message-ID: <20200407152237.1468704-2-anthony.perard@citrix.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200407152237.1468704-1-anthony.perard@citrix.com> References: <20200407152237.1468704-1-anthony.perard@citrix.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 216.71.145.142 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , xen-devel@lists.xenproject.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell The function usbback_packet_complete() currently takes a USBPacket*, which must be a pointer to the packet field within a struct usbback_req; the function uses container_of() to get the struct usbback_req* given the USBPacket*. This is unnecessarily confusing (and in particular it confuses the Coverity Scan analysis, resulting in the false positive CID 1421919 where it thinks that we write off the end of the structure). Since both callsites already have the pointer to the struct usbback_req, just pass that in directly. Signed-off-by: Peter Maydell Acked-by: Gerd Hoffmann Reviewed-by: Anthony PERARD Message-Id: <20200323164318.26567-1-peter.maydell@linaro.org> Signed-off-by: Anthony PERARD --- hw/usb/xen-usb.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- Anthony PERARD diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c index 1fc2f32ce93d..961190d0f78c 100644 --- a/hw/usb/xen-usb.c +++ b/hw/usb/xen-usb.c @@ -347,13 +347,11 @@ static int32_t usbback_xlat_status(int status) return -ESHUTDOWN; } -static void usbback_packet_complete(USBPacket *packet) +static void usbback_packet_complete(struct usbback_req *usbback_req) { - struct usbback_req *usbback_req; + USBPacket *packet = &usbback_req->packet; int32_t status; - usbback_req = container_of(packet, struct usbback_req, packet); - QTAILQ_REMOVE(&usbback_req->stub->submit_q, usbback_req, q); status = usbback_xlat_status(packet->status); @@ -566,7 +564,7 @@ static void usbback_dispatch(struct usbback_req *usbback_req) usb_handle_packet(usbback_req->stub->dev, &usbback_req->packet); if (usbback_req->packet.status != USB_RET_ASYNC) { - usbback_packet_complete(&usbback_req->packet); + usbback_packet_complete(usbback_req); } return; @@ -993,7 +991,7 @@ static void xen_bus_complete(USBPort *port, USBPacket *packet) usbif = usbback_req->usbif; TR_REQ(&usbif->xendev, "\n"); - usbback_packet_complete(packet); + usbback_packet_complete(usbback_req); } static USBPortOps xen_usb_port_ops = {