From nobody Mon Feb 9 00:38:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1629896120; cv=none; d=zohomail.com; s=zohoarc; b=hrE1dij1amcqOPvVZ5pX7xTaryLswSdKRLeNHBZt48G/N+5FRV734vkmRE5qKjVP1VieMt9O9I5JJXQdAhVwD9DQ5WHwyR6g3/3MZdtcRyQ5h33IS3eXBY2R+5U2ga2ShDLw06RGDtoxmE/ijoar/jgit78CPZrz+g99nYZWbnc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629896120; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2qHkr/DhCqj/McGvbuXriZ01as83gZFw5jDV9qWYOcY=; b=fhPYkoBoxwiocrS81oB56m3Wwnonh8xiS6jUcc38n5mphkyhS4S230pk7tk4uZAr3yl/UigsGTpz5h79RZU1rsClF8NHon5D2ZG6S/mXsz6kF3XLBKRrZIVpBEEqQXb4431uHFB8MnfJyLX4IQ72SaoltHIXUNtAP7dgRKVz2Ow= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1629896120550162.95011511642383; Wed, 25 Aug 2021 05:55:20 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-96-Q8t5DQDdOvKdidG-dOyVcQ-1; Wed, 25 Aug 2021 08:55:17 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 351D71008065; Wed, 25 Aug 2021 12:55:12 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 15DE360C04; Wed, 25 Aug 2021 12:55:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CBA704BB7C; Wed, 25 Aug 2021 12:55:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17PCtBR0015122 for ; Wed, 25 Aug 2021 08:55:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2608D10016FB; Wed, 25 Aug 2021 12:55:11 +0000 (UTC) Received: from bart.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4AAA10074F8 for ; Wed, 25 Aug 2021 12:55:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629896119; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2qHkr/DhCqj/McGvbuXriZ01as83gZFw5jDV9qWYOcY=; b=coc0Pf12o5d+Pdxui6eh0ts9E4tXvFY/7EnNgU3AAGEXir7dnb5J+aNYR4yMHx7e88pxSo B43nzfwf3kY+L3ImT6QnN+K/RyXKm0XG6iLf1GiJgRi/45Gi2LD68P+L01+bcUA8Okgqv4 jnDvV9wXDkOh2t06CxZ1NT+XbXGSeqs= X-MC-Unique: Q8t5DQDdOvKdidG-dOyVcQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/4] virpci: Avoid Clang false positive Date: Wed, 25 Aug 2021 14:54:56 +0200 Message-Id: <5a47517cbdd6968f428b4f754a371a2af0565b25.1629895768.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1629896122437100003 Content-Type: text/plain; charset="utf-8" The virPCIDeviceIsBehindSwitchLackingACS() function checks whether given PCI device is not behind a switch that lacks ACS. It does so by starting at given device and traversing up, one parent at time towards the root. The parent device is obtained via virPCIDeviceGetParent() which allocates new virPCIDevice structure. For freeing the structure we use g_autoptr() and a temporary variable @tmp. However, Clang fails to understand our clever algorithm and complains that the variable is set but never used. This is obviously a false positive, but using a small trick we can shut Clang up. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/util/virpci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index 915a4903ca..f307580a53 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2150,8 +2150,8 @@ virPCIDeviceIsBehindSwitchLackingACS(virPCIDevice *de= v) return 1; } =20 - tmp =3D parent; - ret =3D virPCIDeviceGetParent(parent, &parent); + tmp =3D g_steal_pointer(&parent); + ret =3D virPCIDeviceGetParent(tmp, &parent); if (ret < 0) return -1; } while (parent); --=20 2.31.1