From nobody Mon Feb 9 09:30:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1765314083; cv=none; d=zohomail.com; s=zohoarc; b=aXHnd4hI454gnJH0DYtV9yEpBCmXAeAMIJeygNRjfoK+Z8vroUPm2leMqwavnbxqEoyV71+uATPXy0anb0PfKYrZWpn9Xh5dsRIDvvwJiG2oys/NLxhGsum6/wQmrvwe9BHuqtbLZF86VVcGBl8UEiQmnIdsLMrta/j9dWY1GtM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765314083; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=ogxbQgChcwDhL6oUB1Q8nKSGlmrVr2cBrLdq1ByqOys=; b=OiYm+cxUPRABX7hqZ06HOOWHNFirxklSPDM+IIhoR5E6InBbsjI9tqJZRjC32I0Hfh+kNCjgZLpYINpyJtDRfwaNhsBo3BTOellllT+YdSbS0H2Fs/3Moe7gxxv0vKEZ7HjG488VpsraqaPtMnE/iIIXXLEzGpd3Mhx9G2lbxYc= ARC-Authentication-Results: i=1; mx.zohomail.com; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765314083125806.5725971819373; Tue, 9 Dec 2025 13:01:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vT4p8-0006Di-BN; Tue, 09 Dec 2025 16:00:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vT4ow-0006D6-Mf; Tue, 09 Dec 2025 16:00:30 -0500 Received: from mail.weilnetz.de ([37.120.169.71] helo=mail.v2201612906741603.powersrv.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vT4ou-00058f-MY; Tue, 09 Dec 2025 16:00:30 -0500 Received: from qemu.weilnetz.de (qemu.weilnetz.de [188.68.58.204]) by mail.v2201612906741603.powersrv.de (Postfix) with ESMTP id D4A0CDA0755; Tue, 09 Dec 2025 22:00:22 +0100 (CET) Received: by qemu.weilnetz.de (Postfix, from userid 1000) id ED117460023; Tue, 09 Dec 2025 22:00:17 +0100 (CET) Authentication-Results: mail.v2201612906741603.powersrv.de; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=weilnetz.de (policy=none); spf=softfail (mail.v2201612906741603.powersrv.de: 188.68.58.204 is neither permitted nor denied by domain of stefan@weilnetz.de) smtp.mailfrom=stefan@weilnetz.de To: Peter Xu , Fabiano Rosas , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Cc: qemu-devel@nongnu.org, qemu-trivial@nongnu.org, Stefan Weil Subject: [PATCH-for-10.2 v2] migration: Replace g_malloc0_n by g_new0 (fixes compiler warning) Date: Tue, 9 Dec 2025 22:00:17 +0100 Message-ID: <20251209210017.768535-1-sw@weilnetz.de> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: v2201612906741603 X-Rspamd-Queue-Id: D4A0CDA0755 X-Spamd-Bar: ++ X-Spamd-Result: default: False [2.10 / 12.00]; VIOLATED_DIRECT_SPF(3.50)[]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; FORGED_SENDER(0.30)[sw@weilnetz.de,stefan@weilnetz.de]; ONCE_RECEIVED(0.20)[]; DMARC_POLICY_SOFTFAIL(0.10)[weilnetz.de : No valid SPF, No valid DKIM,quarantine,sampled_out]; MIME_GOOD(-0.10)[text/plain]; RCVD_NO_TLS_LAST(0.10)[]; ASN(0.00)[asn:197540, ipnet:188.68.56.0/22, country:DE]; TO_DN_SOME(0.00)[]; RCVD_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; R_DKIM_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_SEVEN(0.00)[8]; FROM_NEQ_ENVFROM(0.00)[sw@weilnetz.de,stefan@weilnetz.de]; R_SPF_SOFTFAIL(0.00)[~all:c]; DBL_BLOCKED_OPENRESOLVER(0.00)[qemu.weilnetz.de:rdns,qemu.weilnetz.de:helo] X-Rspamd-Action: no action 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=37.120.169.71; envelope-from=stefan@weilnetz.de; helo=mail.v2201612906741603.powersrv.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Stefan Weil From: Stefan Weil via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1765314084867158500 This fixes a compiler error when higher warning levels are enabled: ../migration/postcopy-ram.c: In function =E2=80=98postcopy_temp_pages_setup= =E2=80=99: ../migration/postcopy-ram.c:1483:50: error: =E2=80=98g_malloc0_n=E2=80=99 s= izes specified with =E2=80=98sizeof=E2=80=99 in the earlier argument and no= t in the later argument [-Werror=3Dcalloc-transposed-args] 1483 | mis->postcopy_tmp_pages =3D g_malloc0_n(sizeof(PostcopyTmpPage)= , channels); | ^~~~~~~~~~~~~~~ ../migration/postcopy-ram.c:1483:50: note: earlier argument should specify = number of elements, later size of each element Avoid also a related int/unsigned mismatch by fixing the type of two local variables. Signed-off-by: Stefan Weil Reviewed-by: Richard Henderson --- v2: Replace g_malloc0_n by g_new0. Thanks for all comments and reviews. Stefan migration/postcopy-ram.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 3f98dcb6fd..8bef0192aa 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -1467,7 +1467,8 @@ retry: static int postcopy_temp_pages_setup(MigrationIncomingState *mis) { PostcopyTmpPage *tmp_page; - int err, i, channels; + int err; + unsigned i, channels; void *temp_page; =20 if (migrate_postcopy_preempt()) { @@ -1479,7 +1480,7 @@ static int postcopy_temp_pages_setup(MigrationIncomin= gState *mis) } =20 channels =3D mis->postcopy_channels; - mis->postcopy_tmp_pages =3D g_malloc0_n(sizeof(PostcopyTmpPage), chann= els); + mis->postcopy_tmp_pages =3D g_new0(PostcopyTmpPage, channels); =20 for (i =3D 0; i < channels; i++) { tmp_page =3D &mis->postcopy_tmp_pages[i]; --=20 2.47.3