diff mbox

[v2,1/3] numa: Reject CPU indexes > max_cpus

Message ID 1423511596-2584-2-git-send-email-ehabkost@redhat.com
State New
Headers show

Commit Message

Eduardo Habkost Feb. 9, 2015, 7:53 p.m. UTC
The CPU indexes for NUMA nodes make sense only up to max_cpus, and CPU
indexes > max_cpus are ignored. Reject configuration which uses invalid
CPU indexes.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 numa.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Igor Mammedov Feb. 12, 2015, 1:42 p.m. UTC | #1
On Mon,  9 Feb 2015 17:53:14 -0200
Eduardo Habkost <ehabkost@redhat.com> wrote:

> The CPU indexes for NUMA nodes make sense only up to max_cpus, and CPU
> indexes > max_cpus are ignored. Reject configuration which uses invalid
> CPU indexes.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  numa.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/numa.c b/numa.c
> index 0d15375..f768434 100644
> --- a/numa.c
> +++ b/numa.c
> @@ -76,9 +76,10 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
>      }
>  
>      for (cpus = node->cpus; cpus; cpus = cpus->next) {
> -        if (cpus->value > MAX_CPUMASK_BITS) {
> -            error_setg(errp, "CPU number %" PRIu16 " is bigger than %d",
> -                       cpus->value, MAX_CPUMASK_BITS);
> +        if (cpus->value > max_cpus) {
> +            error_setg(errp,
> +                       "CPU number %" PRIu16 " is bigger than maxcpus (%d)",
> +                       cpus->value, max_cpus);
>              return;
>          }
>          bitmap_set(numa_info[nodenr].node_cpu, cpus->value, 1);

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
diff mbox

Patch

diff --git a/numa.c b/numa.c
index 0d15375..f768434 100644
--- a/numa.c
+++ b/numa.c
@@ -76,9 +76,10 @@  static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
     }
 
     for (cpus = node->cpus; cpus; cpus = cpus->next) {
-        if (cpus->value > MAX_CPUMASK_BITS) {
-            error_setg(errp, "CPU number %" PRIu16 " is bigger than %d",
-                       cpus->value, MAX_CPUMASK_BITS);
+        if (cpus->value > max_cpus) {
+            error_setg(errp,
+                       "CPU number %" PRIu16 " is bigger than maxcpus (%d)",
+                       cpus->value, max_cpus);
             return;
         }
         bitmap_set(numa_info[nodenr].node_cpu, cpus->value, 1);