Skip to contentSkip to conversation

x86/Dom0: Don't allow dom0_max_vcpus to be zero

PATCH In review Boris Ostrovsky 4 participants 5 messages Apr 9, 2015 – Apr 14, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/Dom0: Don't allow dom0_max_vcpus to be zero

In case dom0_max_vcpus is incorrectly specified on boot line make sure we will still boot.

---
 xen/arch/x86/domain_build.c | 2 ++
 1 file changed, 2 insertions(+)
xen/arch/x86/domain_build.c +2 -0
index e5c845c..378e650 100644
@@ -92,6 +92,8 @@ static void __init parse_dom0_max_vcpus(const char *s)
     else                               /* N, N-, or N-M */
     {
         opt_dom0_max_vcpus_min = simple_strtoul(s, &s, 0);
+        if ( opt_dom0_max_vcpus_min == 0 )
+            opt_dom0_max_vcpus_min = 1;
         if ( !*s )                    /* N */
             opt_dom0_max_vcpus_max = opt_dom0_max_vcpus_min;
         else if ( *s++ == '-' && *s ) /* N-M */
Signature · 1 line
1.8.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Boris Ostrovsky

In case dom0_max_vcpus is incorrectly specified on boot line make sure we will still boot.

Good catch - lets not do that.

Quoted 17 lines
---
 xen/arch/x86/domain_build.c | 2 ++
 1 file changed, 2 insertions(+)
xen/arch/x86/domain_build.c +2 -0
index e5c845c..378e650 100644
@@ -92,6 +92,8 @@ static void __init parse_dom0_max_vcpus(const char *s)
     else                               /* N, N-, or N-M */
     {
         opt_dom0_max_vcpus_min = simple_strtoul(s, &s, 0);
+        if ( opt_dom0_max_vcpus_min == 0 )
+            opt_dom0_max_vcpus_min = 1;
         if ( !*s )                    /* N */
             opt_dom0_max_vcpus_max = opt_dom0_max_vcpus_min;
         else if ( *s++ == '-' && *s ) /* N-M */
#2 lore raw
Quoted 9 lines · Andrew Cooper
Quoted 4 lines · Boris Ostrovsky

In case dom0_max_vcpus is incorrectly specified on boot line make sure we will still boot.

Good catch - lets not do that.

Aye,

Quoted 19 lines
Quoted 18 lines
---
 xen/arch/x86/domain_build.c | 2 ++
 1 file changed, 2 insertions(+)
xen/arch/x86/domain_build.c +2 -0
index e5c845c..378e650 100644
@@ -92,6 +92,8 @@ static void __init parse_dom0_max_vcpus(const char *s)
     else                               /* N, N-, or N-M */
     {
         opt_dom0_max_vcpus_min = simple_strtoul(s, &s, 0);
+        if ( opt_dom0_max_vcpus_min == 0 )
+            opt_dom0_max_vcpus_min = 1;
         if ( !*s )                    /* N */
             opt_dom0_max_vcpus_max = opt_dom0_max_vcpus_min;
         else if ( *s++ == '-' && *s ) /* N-M */
#3 lore raw
In reply to Andrew Cooper
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 09.04.15 at 22:59, <[email protected]> wrote:
Quoted 4 lines · Boris Ostrovsky

In case dom0_max_vcpus is incorrectly specified on boot line make sure we will still boot.

Good catch - lets not do that.

I see it got committed already, and I don't really mind the change, but - are we really in need of this? I.e. are we really rejecting bad or insane command line option values everywhere else? I very much doubt that, and it very much looks like a "then don't do this" thing to me...

Jan

#4 lore raw
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 09.04.15 at 22:59, <[email protected]> wrote:
Quoted 4 lines · Boris Ostrovsky

In case dom0_max_vcpus is incorrectly specified on boot line make sure we will still boot.

Quoted 8 lines
Quoted 3 lines

Good catch - lets not do that.

I see it got committed already, and I don't really mind the change, but - are we really in need of this? I.e. are we really rejecting bad or insane command line option values everywhere else? I very much doubt that, and it very much looks like a "then don't do this" thing to me...

This actually happened to me (something happened with our installer). I agree that we can't predict how every option can go bad but we do try to prevent obvious errors so I figured this was worth a patch, especially given that it was pretty trivial.

-boris