From nobody Sat Feb 7 05:53:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1620315125; cv=none; d=zohomail.com; s=zohoarc; b=S4ZXNKShpRlZHhV0Rk/bUZNtenXY6Qy3lLI4f1lRNtYCBEF5KG5LifXZmllDB6mQCarT2SOxvv9h2rUVPQECddJMm6PToQQWG/JA4458ru7Y3ZF+Xwjd4CPHhOWy1sYpV96O0ErYV/WHCuRKMnUicWfNC5wiSbChM69DDhFqHnw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620315125; 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=Uknvjw8SHvSmWiPUdgbRfmVC+/5mQhVuBthzg3N9Qv0=; b=ViIdsknxFE/E3jEm/6znZIFRFhi5DDbSeo22IeKQZwWQuG6UEFGGIZYpu1P/J8g/+Z2+0wlMEBp/Gp05A4QRXQ1BQpt9FXrQT4XVOamUPs/ZpIuYCRKAnw3rIppsBM9EkVzEW3oo5DYj3rYGHb+AhWhvKEU32fzfDDh9QjQkEYg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1620315125480221.1956870966544; Thu, 6 May 2021 08:32:05 -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-24-BuB8QfiOMnet5fbFBI8_sg-1; Thu, 06 May 2021 11:31:23 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 50DCA800685; Thu, 6 May 2021 15:31:17 +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 1894F62923; Thu, 6 May 2021 15:31:17 +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 C9F1955352; Thu, 6 May 2021 15:31:16 +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 146FVDVd011339 for ; Thu, 6 May 2021 11:31:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 31BAE10016F8; Thu, 6 May 2021 15:31:13 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E89D1002EF0 for ; Thu, 6 May 2021 15:31:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620315123; 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=Uknvjw8SHvSmWiPUdgbRfmVC+/5mQhVuBthzg3N9Qv0=; b=ggdKFrZfl2eBYIOUAM7lN7zztX9eJsTuFjUXw0uCv1TywmFLaZmA4lxIW5saLkpeKzugA6 gqQp69U2x3OF1k5ZUJqE2Vo6BC5X2NtbF7xK4FSKLW8e31WJPtPskr4wn2+VDhNxWfpwK+ fgzn5mHajnQYh+gS5AMs0h5l6jogVGY= X-MC-Unique: BuB8QfiOMnet5fbFBI8_sg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/17] virXMLPropULongLong: Always initialize @result Date: Thu, 6 May 2021 17:30:54 +0200 Message-Id: <718f070b5410363a78baaa4ee45b7700b8d77847.1620314826.git.pkrempa@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.15 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) Content-Type: text/plain; charset="utf-8" Compilers aren't able to see whether @result is set or not and thus don't warn of a potential use of uninitialized value. Always set @result to prevent uninitialized use. Signed-off-by: Peter Krempa --- src/util/virxml.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/virxml.c b/src/util/virxml.c index 9929064993..707a6a2235 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -762,6 +762,7 @@ virXMLPropUInt(xmlNodePtr node, * @result: The returned value * * Convenience function to return value of an unsigned long long attribute. + * @result is initialized to 0 on error or if the element is not found. * * Returns 1 in case of success in which case @result is set, * or 0 if the attribute is not present, @@ -778,6 +779,8 @@ virXMLPropULongLong(xmlNodePtr node, int ret; unsigned long long val; + *result =3D 0; + if (!(tmp =3D virXMLPropString(node, name))) { if (!(flags & VIR_XML_PROP_REQUIRED)) return 0; --=20 2.30.2