xen/arch/x86/x86_64/mmconfig-shared.c: let custom parameter parsing routines return...
authorJuergen Gross <jgross@suse.com>
Wed, 23 Aug 2017 17:34:00 +0000 (19:34 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 25 Aug 2017 14:17:08 +0000 (16:17 +0200)
Modify the custom parameter parsing routines in:

xen/arch/x86/x86_64/mmconfig-shared.c

to indicate whether the parameter value was parsed successfully.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/x86_64/mmconfig-shared.c

index dbf9ff07fa1692cc2375ffbbf76a7f77b80aea0d..7c3b7fd30b17c751329f6189b2e7e86d5b8880d8 100644 (file)
 
 unsigned int pci_probe = PCI_PROBE_CONF1 | PCI_PROBE_MMCONF;
 
-static void __init parse_mmcfg(char *s)
+static int __init parse_mmcfg(const char *s)
 {
-    char *ss;
+    const char *ss;
+    int rc = 0;
 
     do {
         ss = strchr(s, ',');
-        if ( ss )
-            *ss = '\0';
+        if ( !ss )
+            ss = strchr(s, '\0');
 
-        if ( !parse_bool(s, NULL) )
+        switch ( parse_bool(s, ss) )
+        {
+        case 0:
             pci_probe &= ~PCI_PROBE_MMCONF;
-        else if ( !strcmp(s, "amd_fam10") || !strcmp(s, "amd-fam10") )
-            pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
+            break;
+        case 1:
+            break;
+        default:
+            if ( !strncmp(s, "amd_fam10", ss - s) ||
+                 !strncmp(s, "amd-fam10", ss - s) )
+                pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
+            else
+                rc = -EINVAL;
+            break;
+        }
 
         s = ss + 1;
-    } while ( ss );
+    } while ( *ss );
+
+    return rc;
 }
 custom_param("mmcfg", parse_mmcfg);