From nobody Fri Mar 29 00:08:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531187673274917.5974603273564; Mon, 9 Jul 2018 18:54:33 -0700 (PDT) Received: from localhost ([::1]:45327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fchrM-0008P4-9r for importer@patchew.org; Mon, 09 Jul 2018 21:54:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fchpy-0007fl-Qo for qemu-devel@nongnu.org; Mon, 09 Jul 2018 21:53:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fchpv-0007Mj-Pc for qemu-devel@nongnu.org; Mon, 09 Jul 2018 21:53:06 -0400 Received: from ozlabs.org ([203.11.71.1]:52671) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fchpv-0007M7-DL; Mon, 09 Jul 2018 21:53:03 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41Plb05vpmz9s1R; Tue, 10 Jul 2018 11:53:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531187580; bh=CzDIru3fTMMBp2YXxOpUuHz87/YuzznoI2FWbrxgiu4=; h=From:To:Cc:Subject:Date:From; b=RH28tJ+e2p1UZZZcQ6WkjIxhJ6NnKf2XBBWWTQT4vuumTPfmfZo9qML/8xlVUMaj0 kHkhwt1rISs1o1ggBqQLSxpStE7EleVAQcon7ypeHkhZRIXktFsREL8EQ2cI3XkpSs GyjDynKee8SEaMRNh+H5XNcQXYOjMJCAA1JjmZv8= From: David Gibson To: imammedo@redhat.com Date: Tue, 10 Jul 2018 11:52:57 +1000 Message-Id: <20180710015257.12083-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PATCH] spapr: Correct inverted test in spapr_pc_dimm_node() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Gibson , qemu-ppc@nongnu.org, ehabkost@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This function was introduced between v2.11 and v2.12 to replace obsolete ways of specifying the NUMA nodes for DIMMs. It's used to find the correct node for an LMB, by locating which DIMM object it lies within. Unfortunately, one of the checks is inverted, so we check whether the address is less than two different things, rather than actually checking a range. This introduced a regression, meaning that after a reboot qemu will advertise incorrect node information for memory to the guest. Signed-off-by: David Gibson Reviewed-by: Greg Kurz Reviewed-by: Igor Mammedov --- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 3f5e1d3ec2..421b2dd09b 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -665,7 +665,7 @@ static uint32_t spapr_pc_dimm_node(MemoryDeviceInfoList= *list, ram_addr_t addr) if (value && value->type =3D=3D MEMORY_DEVICE_INFO_KIND_DIMM) { PCDIMMDeviceInfo *pcdimm_info =3D value->u.dimm.data; =20 - if (pcdimm_info->addr >=3D addr && + if (addr >=3D pcdimm_info->addr && addr < (pcdimm_info->addr + pcdimm_info->size)) { return pcdimm_info->node; } --=20 2.17.1