From nobody Tue Apr 15 19:52:17 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621861486; cv=none; d=zohomail.com; s=zohoarc; b=UilBu5XWhxnTAcRf9lfgdXOVVDSNgU0wibvduDbizsrzCG7aj51+VY0wsGoAIy0A03eLydDv4XqjiI1KZpwGND2fqKqYXW6qucqwwO44K3XIMm2tsEleBkHGn7WKBYZ0snpy3gUc32djCtB5N305gzm22gsoTyNpq71NICFYd80= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621861486; h=Content-Type:Content-Transfer-Encoding:Cc: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=r4lIr8BTDrF1dGkThDE8cvCezt7DIcFxQLMJnW043xk=; b=YeDVeYyte1ORkGqfCbEoyxvy1VtF5hJxsiuBlPlOsfjgXAAV3fd/ti2AHsIYmS2Lu80KsYZAqBYINbbp2NPeRl87SsNAfRP2b+OaL5nyiY+eOlc9miz+8hL9Y9OCzKLoNHli6qd69Z3sfiGY2dtEug4iCFjR7UIaXBdGpCMvihM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162186148632444.686983643410144; Mon, 24 May 2021 06:04:46 -0700 (PDT) Received: from localhost ([::1]:36180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llAGC-0005nU-JT for importer@patchew.org; Mon, 24 May 2021 09:04:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llADk-0002Gv-Nx for qemu-devel@nongnu.org; Mon, 24 May 2021 09:02:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34549) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llADe-0007cc-Oj for qemu-devel@nongnu.org; Mon, 24 May 2021 09:02:12 -0400 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-578-4qj5ss7FPS-i2Fyce8zk-g-1; Mon, 24 May 2021 09:02:00 -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 C2569A40C3; Mon, 24 May 2021 13:01:58 +0000 (UTC) Received: from localhost (ovpn-113-244.ams2.redhat.com [10.36.113.244]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9296B2DE98; Mon, 24 May 2021 13:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621861323; 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=r4lIr8BTDrF1dGkThDE8cvCezt7DIcFxQLMJnW043xk=; b=E0YCSomfL3IlSxkqVndySIYEg9X+8N6y/zKnlwYWpGlwnhLAnkbaYNv5kfuP84d3JeWFBu O/IlbJwZg7qXw9ZPP5lIrnchLyRdoSNTGaloZEtDzBzHEKsq3PMNxU0etwLZu8Uy8S0KC5 AZAsC5zennDbbkQTY6oRCyPrK8TbMSk= X-MC-Unique: 4qj5ss7FPS-i2Fyce8zk-g-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL for-6.0 1/8] multi-process: Initialize variables declared with g_auto* Date: Mon, 24 May 2021 14:00:17 +0100 Message-Id: <20210524130024.50651-2-stefanha@redhat.com> In-Reply-To: <20210524130024.50651-1-stefanha@redhat.com> References: <20210524130024.50651-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.371, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Fam Zheng , John G Johnson , Vladimir Sementsov-Ogievskiy , Jagannathan Raman , qemu-block@nongnu.org, Juan Quintela , Stefan Weil , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Elena Ufimtseva , Max Reitz , John Snow , Stefan Hajnoczi , Zenghui Yu , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Miroslav Rezanina , Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Zenghui Yu Quote docs/devel/style.rst (section "Automatic memory deallocation"): * Variables declared with g_auto* MUST always be initialized, otherwise the cleanup function will use uninitialized stack memory Initialize @name properly to get rid of the compilation error (using gcc-7.3.0 on CentOS): ../hw/remote/proxy.c: In function 'pci_proxy_dev_realize': /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: 'name' may be u= sed uninitialized in this function [-Werror=3Dmaybe-uninitialized] g_free (*pp); ^~~~~~~~~~~~ ../hw/remote/proxy.c:350:30: note: 'name' was declared here g_autofree char *name; ^~~~ Signed-off-by: Zenghui Yu Reviewed-by: Jagannathan Raman Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Miroslav Rezanina Message-id: 20210312112143.1369-1-yuzenghui@huawei.com Signed-off-by: Stefan Hajnoczi --- hw/remote/memory.c | 5 ++--- hw/remote/proxy.c | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/remote/memory.c b/hw/remote/memory.c index 2d4174614a..472ed2a272 100644 --- a/hw/remote/memory.c +++ b/hw/remote/memory.c @@ -41,10 +41,9 @@ void remote_sysmem_reconfig(MPQemuMsg *msg, Error **errp) =20 remote_sysmem_reset(); =20 - for (region =3D 0; region < msg->num_fds; region++) { - g_autofree char *name; + for (region =3D 0; region < msg->num_fds; region++, suffix++) { + g_autofree char *name =3D g_strdup_printf("remote-mem-%u", suffix); subregion =3D g_new(MemoryRegion, 1); - name =3D g_strdup_printf("remote-mem-%u", suffix++); memory_region_init_ram_from_fd(subregion, NULL, name, sysmem_info->sizes[region], true, msg->fds[region], diff --git a/hw/remote/proxy.c b/hw/remote/proxy.c index 4fa4be079d..6dda705fc2 100644 --- a/hw/remote/proxy.c +++ b/hw/remote/proxy.c @@ -347,13 +347,12 @@ static void probe_pci_info(PCIDevice *dev, Error **er= rp) PCI_BASE_ADDRESS_SPACE_IO : PCI_BASE_ADDRESS_SPACE_MEMO= RY; =20 if (size) { - g_autofree char *name; + g_autofree char *name =3D g_strdup_printf("bar-region-%d", i); pdev->region[i].dev =3D pdev; pdev->region[i].present =3D true; if (type =3D=3D PCI_BASE_ADDRESS_SPACE_MEMORY) { pdev->region[i].memory =3D true; } - name =3D g_strdup_printf("bar-region-%d", i); memory_region_init_io(&pdev->region[i].mr, OBJECT(pdev), &proxy_mr_ops, &pdev->region[i], name, size); --=20 2.31.1