From nobody Sat Feb 7 05:53:49 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=1620315137; cv=none; d=zohomail.com; s=zohoarc; b=Sbn9BL4d0bBfeqzy36bI9k6k1hjl083EjG0PDkWfS8tHrN9Gzcs28GoXTvWGA6HJZRTdI4MnThiA7yCUz0fvv+68hHyCIjxSfrIziKKLKEE2Rb9kL52F1QJ8D6/Atw9KnOiCWUktXQDZjQibE54psYS6JUs3u3lkSQ6JPi0TikM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620315137; 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=2nBXxX/RflK7WtSF/VGVD0Rgyu9iSJiZyNlQEzUxdnw=; b=NzmcrYzrBMFQPaHxwtMRId56QLPl0wN/WEI9QcIiXUjmu3QP3yK7VQ0wHeCEoXveYOLi016qYnCYVLO5utllroIrJgUgWfvFSzFvSfogVL8e3174MO2Nb8ioAbL06CLn3i7OS3QC2JtFB29NO6p4ZPVvb2Sq71ahSVnNboUCofM= 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 1620315137515894.2088615175991; Thu, 6 May 2021 08:32:17 -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-258-UwWKyU4rNNecR_WiPsK_cw-1; Thu, 06 May 2021 11:31:27 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5528D100A68C; Thu, 6 May 2021 15:31:18 +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 2D8B019D61; Thu, 6 May 2021 15:31:18 +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 E672355352; Thu, 6 May 2021 15:31:17 +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 146FVGKC011372 for ; Thu, 6 May 2021 11:31:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 539F110027A5; Thu, 6 May 2021 15:31:16 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8E1310016F8 for ; Thu, 6 May 2021 15:31:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620315135; 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=2nBXxX/RflK7WtSF/VGVD0Rgyu9iSJiZyNlQEzUxdnw=; b=hb5Z97OwXBVt69sA288xmMjBFZ81c6NCWQZEfQS025LQHY9OAqpH/Z7LhAvWJrLy9olGnB 4PE5VZv0mbQwOw9xKgu+XhdkR/+O1X2dpUpwBEDrluKtFKN6XJusXx8Iw5hKX5o5/T9SlK 3ObZajZak7ieiaGZCPXQaVbCsFO5gyc= X-MC-Unique: UwWKyU4rNNecR_WiPsK_cw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/17] virXMLPropUInt: Always initialize @result Date: Thu, 6 May 2021 17:30:57 +0200 Message-Id: <6d688354757371f227d1bec05551d53401db0ffd.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.84 on 10.5.11.23 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 707a6a2235..a03cbf7265 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -706,6 +706,7 @@ virXMLPropInt(xmlNodePtr node, * @result: The returned value * * Convenience function to return value of an unsigned integer 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, @@ -722,6 +723,8 @@ virXMLPropUInt(xmlNodePtr node, int ret; unsigned int val; + *result =3D 0; + if (!(tmp =3D virXMLPropString(node, name))) { if (!(flags & VIR_XML_PROP_REQUIRED)) return 0; --=20 2.30.2