]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
xen/arm: traps: Don't ignore invalid value for serrors=
authorJulien Grall <julien.grall@arm.com>
Mon, 21 Oct 2019 12:28:36 +0000 (13:28 +0100)
committerJulien Grall <julien.grall@arm.com>
Fri, 1 Nov 2019 14:31:49 +0000 (14:31 +0000)
serrors= only supports 3 values "diverse", "forward" and "panic".

The current implementation of parse_serrors_behavior() will default to
"diverse" for any invalid value and not tell the users.

Rather than ignore the invalid input, return an error to the caller so
it can decides the be approach.

This will be useful after a follow-up patch where the number of options
will be reduced.

Take the opportunity to initialize serrors_op to SERRORS_DIVERSE rather
than relying on the item to be the first in the enum and therefore
equal to 0.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellin <sstabellini@kernel.org>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/arm/traps.c

index cb4e3b627b5f71a4f6dc7baa84624353792479a3..d028ec9224e4446b31eda688dfbe3df23d17753b 100644 (file)
@@ -104,14 +104,16 @@ register_t get_default_hcr_flags(void)
 static enum {
     SERRORS_DIVERSE,
     SERRORS_PANIC,
-} serrors_op;
+} serrors_op = SERRORS_DIVERSE;
 
 static int __init parse_serrors_behavior(const char *str)
 {
     if ( !strcmp(str, "panic") )
         serrors_op = SERRORS_PANIC;
-    else
+    else if ( !strcmp(str, "diverse") )
         serrors_op = SERRORS_DIVERSE;
+    else
+        return -EINVAL;
 
     return 0;
 }