Modify the custom parameter parsing routines in:

xen/arch/x86/nmi.c

to indicate whether the parameter value was parsed successfully.

Cc: Jan Beulich <jbeul...@suse.com>
Cc: Andrew Cooper <andrew.coop...@citrix.com>
Signed-off-by: Juergen Gross <jgr...@suse.com>
---
 xen/arch/x86/nmi.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
index 8914581f66..038c5608e1 100644
--- a/xen/arch/x86/nmi.c
+++ b/xen/arch/x86/nmi.c
@@ -46,35 +46,43 @@ bool __initdata opt_watchdog;
 /* watchdog_force: If true, process unknown NMIs when running the watchdog. */
 bool watchdog_force;
 
-static void __init parse_watchdog(char *s)
+static int __init parse_watchdog(char *s)
 {
     if ( !*s )
     {
         opt_watchdog = true;
-        return;
+        return 0;
     }
 
     switch ( parse_bool(s) )
     {
     case 0:
         opt_watchdog = false;
-        return;
+        return 0;
     case 1:
         opt_watchdog = true;
-        return;
+        return 0;
     }
 
     if ( !strcmp(s, "force") )
         watchdog_force = opt_watchdog = true;
+    else
+        return -EINVAL;
+
+    return 0;
 }
 custom_param("watchdog", parse_watchdog);
 
 /* opt_watchdog_timeout: Number of seconds to wait before panic. */
 static unsigned int opt_watchdog_timeout = 5;
-static void parse_watchdog_timeout(char * s)
+static int parse_watchdog_timeout(char * s)
 {
-    opt_watchdog_timeout = simple_strtoull(s, NULL, 0);
+    const char *q;
+
+    opt_watchdog_timeout = simple_strtoull(s, &q, 0);
     opt_watchdog = !!opt_watchdog_timeout;
+
+    return *q ? -EINVAL : 0;
 }
 custom_param("watchdog_timeout", parse_watchdog_timeout);
 
-- 
2.12.3


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

Reply via email to