Message ID | 20170816125219.5255-23-jgross@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
>>> On 16.08.17 at 14:51, <jgross@suse.com> wrote: > --- a/xen/arch/x86/x86_64/mmconfig-shared.c > +++ b/xen/arch/x86/x86_64/mmconfig-shared.c > @@ -28,22 +28,35 @@ > > 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) ) > + switch ( parse_bool(s) ) { Style. With this corrected Reviewed-by: Jan Beulich <jbeulich@suse.com> Jan
On 22/08/17 11:55, Jan Beulich wrote: >>>> On 16.08.17 at 14:51, <jgross@suse.com> wrote: >> --- a/xen/arch/x86/x86_64/mmconfig-shared.c >> +++ b/xen/arch/x86/x86_64/mmconfig-shared.c >> @@ -28,22 +28,35 @@ >> >> 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) ) >> + switch ( parse_bool(s) ) { > > Style. With this corrected Another parse_bool() victim. Juergen
diff --git a/xen/arch/x86/x86_64/mmconfig-shared.c b/xen/arch/x86/x86_64/mmconfig-shared.c index 488470bfeb..5a7118481d 100644 --- a/xen/arch/x86/x86_64/mmconfig-shared.c +++ b/xen/arch/x86/x86_64/mmconfig-shared.c @@ -28,22 +28,35 @@ 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) ) + switch ( parse_bool(s) ) { + 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);
Modify the custom parameter parsing routines in: xen/arch/x86/x86_64/mmconfig-shared.c to indicate whether the parameter value was parsed successfully. Cc: Jan Beulich <jbeulich@suse.com> Cc: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Juergen Gross <jgross@suse.com> --- V3: - dont return out of loop (Jan Beulich) - dont modify option value in parsing function --- xen/arch/x86/x86_64/mmconfig-shared.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)