Commit 32532f21 authored by Bharata B Rao's avatar Bharata B Rao Committed by Eduardo Habkost
Browse files

pc-dimm: Fail realization for invalid nodes in non-NUMA config



pc_dimm_realize() validates the NUMA node to which memory hotplug is
being performed only in case of NUMA configuration. Include a check to
fail for invalid nodes in case of non-NUMA configuration too.

Signed-off-by: default avatarBharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
Reviewed-by: default avatarIgor Mammedov <imammedo@redhat.com>
Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
parent 5fdb4671
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -417,10 +417,11 @@ static void pc_dimm_realize(DeviceState *dev, Error **errp)
        error_setg(errp, "'" PC_DIMM_MEMDEV_PROP "' property is not set");
        return;
    }
    if ((nb_numa_nodes > 0) && (dimm->node >= nb_numa_nodes)) {
    if (((nb_numa_nodes > 0) && (dimm->node >= nb_numa_nodes)) ||
        (!nb_numa_nodes && dimm->node)) {
        error_setg(errp, "'DIMM property " PC_DIMM_NODE_PROP " has value %"
                   PRIu32 "' which exceeds the number of numa nodes: %d",
                   dimm->node, nb_numa_nodes);
                   dimm->node, nb_numa_nodes ? nb_numa_nodes : 1);
        return;
    }
}