From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1oIrRj-0003Q9-93 for mharc-qemu-trivial@gnu.org; Tue, 02 Aug 2022 08:56:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIrRf-0003Nh-Ct for qemu-trivial@nongnu.org; Tue, 02 Aug 2022 08:56:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:56830) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIrRd-0007jX-VI for qemu-trivial@nongnu.org; Tue, 02 Aug 2022 08:56:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659444978; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aZeQftzeDudqNV6C91n8UzaezejRJyvkGLuRompR/+g=; b=gkbQlAGLdOzNubPFwWeBSCeRmwwQ8V66Is7kQi5U+nHGDTIIkxQ7kUt+dw7aJM+I1xPiU9 wDQ/djjl3QrEx1xsR4NoIYZvxzNvLOtUEXHF/lHJoG5sDXULc2A9aRf+dvWJamUHf01uMn bsD53EewjOmD8HdUIlOO/zh4ekrADvA= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-451-Zb5h7TFIOY-8ZiYcZPxNOg-1; Tue, 02 Aug 2022 08:56:17 -0400 X-MC-Unique: Zb5h7TFIOY-8ZiYcZPxNOg-1 Received: by mail-ej1-f69.google.com with SMTP id nc38-20020a1709071c2600b007309af9e482so1263482ejc.2 for ; Tue, 02 Aug 2022 05:56:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc; bh=aZeQftzeDudqNV6C91n8UzaezejRJyvkGLuRompR/+g=; b=Mr7sOl+iNUc0uSx98FDx3H7ECWqIY6HzenwK1xLJ0nYHiWYzmNY0U14wySuZtSZzVd LlVHNi9Xu3JUj+QI8/a5tQufhIzr70U15d7dQD2dmsjwbY9vGIuCoKeTtReksEicAaKb V4STqDzmhjWtoGOLjen54iSVSBmCj3J95qvobW3Wqx3FGF410QPVFvrGhP3Rabsfa96p cY5jSnNBUd775FGKA65BUz1phFGA+T6cx573OTxnTkkkMIWXCYpqkwfOl6wtleXKpgM6 AWoOeFf7RuY+7t//cvIS5y0paKvTfxytOPqKa6Pr8aDPVZ0Q0Mu9ExtE4Vqk1FUHth/A lZ4A== X-Gm-Message-State: ACgBeo1REyz1+8u2NdqVmExG1waE0b25LzgOODm15qR4ajjLo5LWy8k+ TJYOgeHgFKMAXi0PzXOmw94VghmI/rr/mGT7OWadfo8UqWd+bU4LzIj6s6wYZ7T4rx4wxyO/uNO pHbHjHrrib5UxxfP/9A== X-Received: by 2002:a17:906:9b09:b0:730:9480:9729 with SMTP id eo9-20020a1709069b0900b0073094809729mr5463902ejc.588.1659444975842; Tue, 02 Aug 2022 05:56:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR5/u+FToM2Zw/LZsnOVJJiLn5P6AmvUYwD7KroZS5Kex/Z8WjOHx+hkUCDVX6jFgKHBcaWtWg== X-Received: by 2002:a17:906:9b09:b0:730:9480:9729 with SMTP id eo9-20020a1709069b0900b0073094809729mr5463888ejc.588.1659444975622; Tue, 02 Aug 2022 05:56:15 -0700 (PDT) Received: from redhat.com ([2.52.130.0]) by smtp.gmail.com with ESMTPSA id wc7-20020a170907124700b0072b55713daesm2470676ejb.56.2022.08.02.05.56.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 05:56:15 -0700 (PDT) Date: Tue, 2 Aug 2022 08:56:10 -0400 From: "Michael S. Tsirkin" To: Laurent Vivier Cc: Eugenio =?iso-8859-1?Q?P=E9rez?= , qemu-devel@nongnu.org, Peter Maydell , qemu-trivial@nongnu.org, Jason Wang Subject: Re: [PATCH 1/2] vdpa: Fix file descriptor leak on get features error Message-ID: <20220802085542-mutt-send-email-mst@kernel.org> References: <20220802112447.249436-1-eperezma@redhat.com> <20220802112447.249436-2-eperezma@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2022 12:56:24 -0000 On Tue, Aug 02, 2022 at 02:07:04PM +0200, Laurent Vivier wrote: > On 02/08/2022 13:24, Eugenio Pérez wrote: > > File descriptor vdpa_device_fd is not free in the case of returning > > error from vhost_vdpa_get_features. Fixing it by making all errors go to > > the same error path. > > > > Resolves: Coverity CID 1490785 > > Fixes: 8170ab3f43 ("vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs") > > > > Signed-off-by: Eugenio Pérez > > --- > > net/vhost-vdpa.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c > > index 6abad276a6..303447a68e 100644 > > --- a/net/vhost-vdpa.c > > +++ b/net/vhost-vdpa.c > > @@ -566,7 +566,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name, > > g_autofree NetClientState **ncs = NULL; > > g_autoptr(VhostIOVATree) iova_tree = NULL; > > NetClientState *nc; > > - int queue_pairs, r, i, has_cvq = 0; > > + int queue_pairs, r, i = 0, has_cvq = 0; > > assert(netdev->type == NET_CLIENT_DRIVER_VHOST_VDPA); > > opts = &netdev->u.vhost_vdpa; > > @@ -582,7 +582,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name, > > r = vhost_vdpa_get_features(vdpa_device_fd, &features, errp); > > if (unlikely(r < 0)) { > > - return r; > > + goto err; > > } > > queue_pairs = vhost_vdpa_get_max_queue_pairs(vdpa_device_fd, features, > > Reviewed-by: Laurent Vivier > > I can take this one via the trivial branch. > > Thanks, > Laurent Not sure why it's appropriate for trivial but sure if you like Reviewed-by: Michael S. Tsirkin