From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHxZp-0004H2-NB for qemu-devel@nongnu.org; Thu, 14 Aug 2014 12:08:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHxZj-0001oM-Gd for qemu-devel@nongnu.org; Thu, 14 Aug 2014 12:08:33 -0400 Date: Thu, 14 Aug 2014 18:08:57 +0200 From: "Michael S. Tsirkin" Message-ID: <1408032488-11096-6-git-send-email-mst@redhat.com> References: <1408032488-11096-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1408032488-11096-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 05/12] pc-dimm: validate node property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Peter Crosthwaite , Hu Tao , qemu-stable@nongnu.org, Vasilis Liaskovitis , Anthony Liguori , Igor Mammedov From: Hu Tao If user specifies a node number that exceeds the available numa nodes in emulated system for pc-dimm device, the device will report an invalid _PXM to OSPM. Fix this by checking the node property value. Cc: qemu-stable@nongnu.org Signed-off-by: Hu Tao Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/mem/pc-dimm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 08f49ed..92e276f 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -252,6 +252,11 @@ static void pc_dimm_realize(DeviceState *dev, Error **errp) error_setg(errp, "'" PC_DIMM_MEMDEV_PROP "' property is not set"); return; } + if (dimm->node >= nb_numa_nodes) { + error_setg(errp, "'" PC_DIMM_NODE_PROP + "' exceeds numa node number: %" PRId32, nb_numa_nodes); + return; + } } static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm) -- MST