From nobody Tue Apr 7 06:15:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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 ARC-Seal: i=1; a=rsa-sha256; t=1773645084; cv=none; d=zohomail.com; s=zohoarc; b=D7OzeH//pjn8bOpg3IpC3DMeBxAgfmJMdTcY3i2CHUkHJC9mQxl0IeTKeydLFma0clH78fW04Ro0r2pytHTRSF5ZWcBvUZBSiVr4yIZWEAGrQgL548QT1YYrb+JNuw7ximPzL1ZInbsj+PU7xTiAeV83FFFpZp294KS9MrG8LqE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773645084; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=K0nXwiekL/pSe/PQJJUSu2+WP+B7V5eUDdyKd2xOrY0=; b=HdYEY5Ig1fgYeQWygn58jdQveJmtRj866dcT31ZcTtvJaHeifputoxf/LeTZEf/XaDKmTHTpAXu/8xC0KfI9maNzET17XpNhqFPtAO67B1P9u8qgtswcpVKIqJXKuGBNCI5dygb/ruBbbkH5sBHv0juVGbNa92OFXA/fqXF4/vI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773645084042493.9894791671337; Mon, 16 Mar 2026 00:11:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w226T-0007vL-JU; Mon, 16 Mar 2026 03:11:05 -0400 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 1w225n-0007VX-L6; Mon, 16 Mar 2026 03:10:29 -0400 Received: from isrv.corpit.ru ([212.248.84.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w225m-0007lY-2j; Mon, 16 Mar 2026 03:10:23 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id A700E193C26; Mon, 16 Mar 2026 10:10:02 +0300 (MSK) Received: from think4mjt.tls.msk.ru (mjtthink.wg.tls.msk.ru [192.168.177.146]) by tsrv.corpit.ru (Postfix) with ESMTP id AF5D338004E; Mon, 16 Mar 2026 10:10:05 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tls.msk.ru; s=202602; t=1773645002; bh=CmDa9F5nfz3aUSXpzzrFQot+GvJGuvW4S/3odYMM1j0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=v1dAAbLixcAvtx3h+20Ub9jTuDTLLRo7STJCLFUF4dJ2KhjaHerZLaUTVW96+ixZl SkdwPds6V/S9l4+YHZE9tMTaYEc3kQTxyiHRBLDrH0wyALsKCXW1xGyQBfDIZbt23P Xy+kwaPGRAwOmR9L1EeHyyQ/bSN8NRc3+tcE4v/srDQ5MvoNYsGnNEE216g45SZwwB XRi8M3jGopyUhTMBBG43+v5Pu0KreTTDJlGKTF3FFUVBjTOEq2LiWySEb2vqDoRhbw 0QZwqjt5MrMuamA9xHBAuozSvLk2i8OzxwJ5C7sziIbM/yKsqWf8k6R43XGZrow2Kj 3DKAOmk61ey3g== From: Michael Tokarev To: qemu-devel@nongnu.org Cc: Sergei Heifetz , qemu-trivial@nongnu.org, Michael Tokarev Subject: [PULL 04/14] system/physmem.c: remove useless assertion of block Date: Mon, 16 Mar 2026 10:09:52 +0300 Message-ID: <20260316071005.91624-5-mjt@tls.msk.ru> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260316071005.91624-1-mjt@tls.msk.ru> References: <20260316071005.91624-1-mjt@tls.msk.ru> MIME-Version: 1.0 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=212.248.84.144; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @tls.msk.ru) X-ZM-MESSAGEID: 1773645086578158500 Content-Type: text/plain; charset="utf-8" From: Sergei Heifetz It is useless to assert that block is not NULL because it is already dereferenced in the first line of the function. The assertion is also unnecessary because the function is called in only two places, and `block` can't be NULL in either of them: - In `migration/ram.c`, we have already dereferenced `block` in the code just before the call. - In `system/memory.c`, we assert `mr->ram_block` before passing it to the function. (We could split the declaration and initialization of oldsize, but then we would need to remove the const qualifier. As the assertion is useless anyway, removing the const qualifier seems worse.) Signed-off-by: Sergei Heifetz Reviewed-by: Peter Maydell Reviewed-by: Peter Xu Reviewed-by: Michael Tokarev Signed-off-by: Michael Tokarev --- system/physmem.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index 4a9e076004..4e26f1a1d4 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -2028,8 +2028,6 @@ int qemu_ram_resize(RAMBlock *block, ram_addr_t newsi= ze, Error **errp) const ram_addr_t oldsize =3D block->used_length; const ram_addr_t unaligned_size =3D newsize; =20 - assert(block); - newsize =3D TARGET_PAGE_ALIGN(newsize); newsize =3D REAL_HOST_PAGE_ALIGN(newsize); =20 --=20 2.47.3