All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/Dom0: minor command line parsing adjustments
@ 2015-02-25 14:47 Jan Beulich
  2015-02-25 16:34 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2015-02-25 14:47 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Keir Fraser

[-- Attachment #1: Type: text/plain, Size: 1437 bytes --]

Remove a redundant statement from parse_dom0_mem() and refuse bogus
ranges (with a separator other than a dash) passed to
parse_dom0_max_vcpus(). Fix coding style issues in the latter function
at the same time.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/domain_build.c
+++ b/xen/arch/x86/domain_build.c
@@ -78,8 +78,6 @@ static void __init parse_dom0_mem(const 
             dom0_max_nrpages = parse_amt(s+4, &s);
         else
             dom0_nrpages = parse_amt(s, &s);
-        if ( *s != ',' )
-            break;
     } while ( *s++ == ',' );
 }
 custom_param("dom0_mem", parse_dom0_mem);
@@ -89,14 +87,14 @@ static unsigned int __initdata opt_dom0_
 
 static void __init parse_dom0_max_vcpus(const char *s)
 {
-    if (*s == '-')              /* -M */
+    if ( *s == '-' )                   /* -M */
         opt_dom0_max_vcpus_max = simple_strtoul(s + 1, &s, 0);
-    else                        /* N, N-, or N-M */
+    else                               /* N, N-, or N-M */
     {
         opt_dom0_max_vcpus_min = simple_strtoul(s, &s, 0);
-        if (*s++ == '\0')       /* N */
+        if ( !*s )                    /* N */
             opt_dom0_max_vcpus_max = opt_dom0_max_vcpus_min;
-        else if (*s != '\0')    /* N-M */
+        else if ( *s++ == '-' && *s ) /* N-M */
             opt_dom0_max_vcpus_max = simple_strtoul(s, &s, 0);
     }
 }




[-- Attachment #2: x86-Dom0-parse.patch --]
[-- Type: text/plain, Size: 1483 bytes --]

x86/Dom0: minor command line parsing adjustments

Remove a redundant statement from parse_dom0_mem() and refuse bogus
ranges (with a separator other than a dash) passed to
parse_dom0_max_vcpus(). Fix coding style issues in the latter function
at the same time.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/domain_build.c
+++ b/xen/arch/x86/domain_build.c
@@ -78,8 +78,6 @@ static void __init parse_dom0_mem(const 
             dom0_max_nrpages = parse_amt(s+4, &s);
         else
             dom0_nrpages = parse_amt(s, &s);
-        if ( *s != ',' )
-            break;
     } while ( *s++ == ',' );
 }
 custom_param("dom0_mem", parse_dom0_mem);
@@ -89,14 +87,14 @@ static unsigned int __initdata opt_dom0_
 
 static void __init parse_dom0_max_vcpus(const char *s)
 {
-    if (*s == '-')              /* -M */
+    if ( *s == '-' )                   /* -M */
         opt_dom0_max_vcpus_max = simple_strtoul(s + 1, &s, 0);
-    else                        /* N, N-, or N-M */
+    else                               /* N, N-, or N-M */
     {
         opt_dom0_max_vcpus_min = simple_strtoul(s, &s, 0);
-        if (*s++ == '\0')       /* N */
+        if ( !*s )                    /* N */
             opt_dom0_max_vcpus_max = opt_dom0_max_vcpus_min;
-        else if (*s != '\0')    /* N-M */
+        else if ( *s++ == '-' && *s ) /* N-M */
             opt_dom0_max_vcpus_max = simple_strtoul(s, &s, 0);
     }
 }

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-25 16:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-25 14:47 [PATCH] x86/Dom0: minor command line parsing adjustments Jan Beulich
2015-02-25 16:34 ` Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.