From nobody Sun Nov 24 20:07:32 2024 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1720782210; cv=none; d=zohomail.com; s=zohoarc; b=gYKj+wDx4pi0w3lYpjMYruQ7NiYJpcf1DNTjLkMZf3b9xdnOE9m6fkJJ5k1vXuGDv8cYaPQ52DIVQfK4sSYVWnzzOp6UZAE2boCF+n85WxROKslfsqbT20l70nYS+aTxi2834cgbyO88YRi8zoAYoXzdlrF2yfSsLUtZSwP3vWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1720782210; h=Content-Type: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=fKWnt4ssz7MnpyKuRbBIUzzN45FF59afh9GBgWcO174=; b=SuluTKwsbXTAtaYa0EfzdcCKSbuOrNtl6bJA/hf789WclblHqAuip8slAwnA50vEPqIoSFGSAm14IwQuBnsNUnrEH8F7ib7idOt9BXjYF9okyYxtZUSg3MrXfidSHvmnYHDQlmGQDhMGiS4vyKryD1hsyu+kX3KXKcfieIA6GCc= 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; 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 1720782210424642.4554623091681; Fri, 12 Jul 2024 04:03:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sSE33-0000Co-8l; Fri, 12 Jul 2024 07:02:45 -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 1sSE30-0008VM-NZ for qemu-devel@nongnu.org; Fri, 12 Jul 2024 07:02:42 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sSE2y-0003ax-Sq for qemu-devel@nongnu.org; Fri, 12 Jul 2024 07:02:42 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-52e9b9fb3dcso2270514e87.1 for ; Fri, 12 Jul 2024 04:02:40 -0700 (PDT) Received: from gmail.com (213-67-3-247-no600.tbcn.telia.com. [213.67.3.247]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52eb9079cbasm1233898e87.309.2024.07.12.04.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jul 2024 04:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720782158; x=1721386958; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fKWnt4ssz7MnpyKuRbBIUzzN45FF59afh9GBgWcO174=; b=aldrw8BfOlQXmbgluuBysNfZOXFTG39l5DJ0IK+pm2drXUdDH1PAEcUuJLTSnZkDnr +nJZH2PXocX2kBWHnE3S0wqEzXhI6OXOoNp/YJdSSVil3gomuykrj3vSXAioL1wCgbuF y7+DWJES1ajUM8ylE2E8rvb5AE/Z0mY/9JWwKcSxwq/RR6DQXRWLJtkNHnsK8OeMnJXf zAvARoFMdsam23JCGds/PkBI2zm+TXywRIss0/LS+IeMKnZdx3stDcSmGVZ5JkhtD3na W9zxqvBfg6NpkH8tmksyKi6ygDQaDZrlD5jPhzyjREtfNSquIK2VxBy85K0AnIreqkgu XPOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720782158; x=1721386958; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fKWnt4ssz7MnpyKuRbBIUzzN45FF59afh9GBgWcO174=; b=dIMNpw7jrf5TpeUYiJQQ0HaDptq7TNga+hh0/+Cm7hb/Tb26o/L01l9cfJsTJswhYt lXjjuVrTwCELMIJqymoSM8nc82lUIctd7rD3T8wYPs4ClASn1caSQVfYsFKvbQeyvQ0x X/3FQWps+hbl0E+pnV8rBXGpP4rV5LsvRphw2PXSv8S4jBniS7NePvBHZAQ2UM1gimnD 4Rv8Z15mD+3fzk4wSchxBcHn5jIqqINM93ScfLlRq9H2/13odm325gkn9eRJfEBcTntR oE7H737yTlMKua1natq/8VG52+p+PdaVvLdp5MfWUgNRNKBA9YQlycV0rdwqnYb6okvD K/aw== X-Gm-Message-State: AOJu0Yy0a8rUIPL9wKP+cNlyGJw6iC2kwTBNbW4KmtUmazx5wUjBOVzl +nZQkeCgwAu1fK0wtslYFJG+2ElQy+Az86rWJW8SPPQk8YeWSVg8SCCve8v+ X-Google-Smtp-Source: AGHT+IGOZ+IbhxesDx8p6m1dAos6T8JaI42mOJvjxpfDN/gOvfWbf+1UhmiRI32EsKvzgaPEKTNk0A== X-Received: by 2002:a05:6512:2107:b0:52e:9d6c:4462 with SMTP id 2adb3069b0e04-52eb99978d9mr5526109e87.23.1720782157305; Fri, 12 Jul 2024 04:02:37 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, alex.bennee@linaro.org, peter.maydell@linaro.org, richard.henderson@linaro.org, edgar.iglesias@amd.com, Paolo Bonzini , Peter Xu , David Hildenbrand , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL v1 2/3] physmem: Bail out qemu_ram_block_from_host() for invalid ram addrs Date: Fri, 12 Jul 2024 13:02:29 +0200 Message-ID: <20240712110230.4098056-3-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240712110230.4098056-1-edgar.iglesias@gmail.com> References: <20240712110230.4098056-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::133; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x133.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1720782211360116600 From: "Edgar E. Iglesias" Bail out in qemu_ram_block_from_host() when xen_ram_addr_from_mapcache() does not find an existing mapping. Signed-off-by: Edgar E. Iglesias Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Stefano Stabellini --- system/physmem.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/system/physmem.c b/system/physmem.c index 14aa025d41..2154432cb6 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -2277,6 +2277,10 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool r= ound_offset, ram_addr_t ram_addr; RCU_READ_LOCK_GUARD(); ram_addr =3D xen_ram_addr_from_mapcache(ptr); + if (ram_addr =3D=3D RAM_ADDR_INVALID) { + return NULL; + } + block =3D qemu_get_ram_block(ram_addr); if (block) { *offset =3D ram_addr - block->offset; --=20 2.43.0