From: Paul Durrant <Paul.Durrant@citrix.com>
To: 'Juergen Gross' <jgross@suse.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>,
Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH v3 09/52] xen/arch/x86/hvm/viridian.c: let custom parameter parsing routines return errno
Date: Mon, 21 Aug 2017 11:45:48 +0000 [thread overview]
Message-ID: <20fcf7ae5e924d3d8f7299a318b6c356@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <439c7766-d776-f4d9-3d65-b570e3530a80@suse.com>
> -----Original Message-----
> From: Juergen Gross [mailto:jgross@suse.com]
> Sent: 21 August 2017 12:02
> To: Paul Durrant <Paul.Durrant@citrix.com>; xen-devel@lists.xenproject.org
> Cc: Jan Beulich <jbeulich@suse.com>; Andrew Cooper
> <Andrew.Cooper3@citrix.com>
> Subject: Re: [PATCH v3 09/52] xen/arch/x86/hvm/viridian.c: let custom
> parameter parsing routines return errno
>
> On 21/08/17 10:33, Paul Durrant wrote:
> >> -----Original Message-----
> >> From: Juergen Gross [mailto:jgross@suse.com]
> >> Sent: 16 August 2017 13:52
> >> To: xen-devel@lists.xenproject.org
> >> Cc: Juergen Gross <jgross@suse.com>; Paul Durrant
> >> <Paul.Durrant@citrix.com>; Jan Beulich <jbeulich@suse.com>; Andrew
> >> Cooper <Andrew.Cooper3@citrix.com>
> >> Subject: [PATCH v3 09/52] xen/arch/x86/hvm/viridian.c: let custom
> >> parameter parsing routines return errno
> >>
> >> Modify the custom parameter parsing routines in:
> >>
> >> xen/arch/x86/hvm/viridian.c
> >>
> >> to indicate whether the parameter value was parsed successfully.
> >>
> >> Fix an error in the parsing function: up to now it would overwrite the
> >> stack in case more than 3 values are specified.
> >>
> >> Cc: Paul Durrant <paul.durrant@citrix.com>
> >> Cc: Jan Beulich <jbeulich@suse.com>
> >> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> >> Signed-off-by: Juergen Gross <jgross@suse.com>
> >> ---
> >> V3:
> >> - dont modify option value in parsing function
> >> - fix error in parsing routine
> >> ---
> >> xen/arch/x86/hvm/viridian.c | 28 ++++++++++++++++++----------
> >> 1 file changed, 18 insertions(+), 10 deletions(-)
> >>
> >> diff --git a/xen/arch/x86/hvm/viridian.c b/xen/arch/x86/hvm/viridian.c
> >> index aa9b87c0ab..2edf9d0b23 100644
> >> --- a/xen/arch/x86/hvm/viridian.c
> >> +++ b/xen/arch/x86/hvm/viridian.c
> >> @@ -1083,7 +1083,7 @@ static int viridian_load_vcpu_ctxt(struct domain
> *d,
> >> hvm_domain_context_t *h)
> >> HVM_REGISTER_SAVE_RESTORE(VIRIDIAN_VCPU,
> viridian_save_vcpu_ctxt,
> >> viridian_load_vcpu_ctxt, 1, HVMSR_PER_VCPU);
> >>
> >> -static void __init parse_viridian_version(char *arg)
> >> +static int __init parse_viridian_version(const char *arg)
> >> {
> >> const char *t;
> >> unsigned int n[3];
> >> @@ -1093,17 +1093,24 @@ static void __init parse_viridian_version(char
> >> *arg)
> >> n[1] = viridian_minor;
> >> n[2] = viridian_build;
> >>
> >> - while ( (t = strsep(&arg, ",")) != NULL )
> >> - {
> >> + do {
> >> const char *e;
> >>
> >> - if ( *t == '\0' )
> >> - continue;
> >> + t = strchr(arg, ',');
> >> + if ( !t )
> >> + t = strchr(arg, '\0');
> >> +
> >> + if ( *arg && *arg != ',' && i < 3 )
> >> + {
> >> + n[i] = simple_strtoul(arg, &e, 0);
> >> + if ( e != t )
> >> + goto fail;
> >> + }
> >> +
> >> + i++;
> >> + arg = t + 1;
> >> + } while ( *t );
> >
> > The loop is much neater when strsep() is used. Could you not just add a
> check for i < 3 at the beginning?
>
> Of course I could. OTOH I don't think the resulting code would be
> neater. I can't remove the check for i being 3 after the loop, so
> I'd have to add some lines instead of testing i < 3 in the already
> present if statement.
>
> In case you are targeting to continue using strsep(): this would
> modify the option string. I want to avoid that as I need it unmodified
> for being able to use it in the error message of patch 39.
Ok, I don't feel that strongly. If you believe this is the neatest way...
Acked-by: Paul Durrant <paul.durrant@citrix.com>
>
>
> Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-08-21 11:45 UTC|newest]
Thread overview: 88+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 12:51 [PATCH v3 00/52] Support for modifying parameters at runtime Juergen Gross
2017-08-16 12:51 ` [PATCH v3 01/52] xen/arch/arm/acpi/boot.c: let custom parameter parsing routines return errno Juergen Gross
2017-08-16 12:51 ` [PATCH v3 02/52] xen/arch/arm/domain_build.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 03/52] xen/arch/arm/traps.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 04/52] xen/arch/x86/apic.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 05/52] xen/arch/x86/cpu/mcheck/mce.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 06/52] xen/arch/x86/cpu/vpmu.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 07/52] xen/arch/x86/dom0_build.c: " Juergen Gross
2017-08-16 13:58 ` Jan Beulich
2017-08-16 12:51 ` [PATCH v3 08/52] xen/arch/x86/genapic/probe.c: " Juergen Gross
2017-08-16 13:59 ` Jan Beulich
2017-08-16 12:51 ` [PATCH v3 09/52] xen/arch/x86/hvm/viridian.c: " Juergen Gross
2017-08-21 8:33 ` Paul Durrant
2017-08-21 11:02 ` Juergen Gross
2017-08-21 11:45 ` Paul Durrant [this message]
2017-08-16 12:51 ` [PATCH v3 10/52] xen/arch/x86/hvm/vmx/vmcs.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 11/52] xen/arch/x86/io_apic.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 12/52] xen/arch/x86/irq.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 13/52] xen/arch/x86/microcode.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 14/52] xen/arch/x86/mm.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 15/52] xen/arch/x86/nmi.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 16/52] xen/arch/x86/numa.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 17/52] xen/arch/x86/oprofile/nmi_int.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 18/52] xen/arch/x86/psr.c: " Juergen Gross
2017-08-22 9:51 ` Jan Beulich
2017-08-23 11:30 ` Juergen Gross
2017-08-16 12:51 ` [PATCH v3 19/52] xen/arch/x86/setup.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 20/52] xen/arch/x86/shutdown.c: " Juergen Gross
2017-08-22 9:53 ` Jan Beulich
[not found] ` <599C1B340200007800171DD1@suse.com>
2017-08-23 8:40 ` Juergen Gross
2017-08-23 8:48 ` Jan Beulich
2017-08-16 12:51 ` [PATCH v3 21/52] xen/arch/x86/time.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 22/52] xen/arch/x86/x86_64/mmconfig-shared.c: " Juergen Gross
2017-08-22 9:55 ` Jan Beulich
2017-08-23 11:49 ` Juergen Gross
2017-08-16 12:51 ` [PATCH v3 23/52] xen/common/core_parking.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 24/52] xen/common/domain.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 25/52] xen/common/efi/boot.c: " Juergen Gross
2017-08-22 9:56 ` Jan Beulich
2017-08-16 12:51 ` [PATCH v3 26/52] xen/common/kexec.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 27/52] xen/common/memory.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 28/52] xen/common/sched_credit2.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 29/52] xen/drivers/acpi/tables.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 30/52] xen/drivers/char/console.c: " Juergen Gross
2017-08-16 12:51 ` [PATCH v3 31/52] xen/drivers/cpufreq/cpufreq.c: " Juergen Gross
2017-08-22 10:01 ` Jan Beulich
2017-08-16 12:51 ` [PATCH v3 32/52] xen/drivers/passthrough/amd/iommu_acpi.c: " Juergen Gross
2017-08-16 12:52 ` [PATCH v3 33/52] xen/drivers/passthrough/iommu.c: " Juergen Gross
2017-08-22 10:04 ` Jan Beulich
[not found] ` <599C1DC70200007800171E22@suse.com>
2017-08-23 9:27 ` Juergen Gross
2017-08-23 9:37 ` Jan Beulich
[not found] ` <599D68F302000078001726B9@suse.com>
2017-08-23 9:49 ` Juergen Gross
2017-08-16 12:52 ` [PATCH v3 34/52] xen/drivers/passthrough/pci.c: " Juergen Gross
2017-08-22 10:07 ` Jan Beulich
[not found] ` <599C1E770200007800171E25@suse.com>
2017-08-23 9:28 ` Juergen Gross
2017-08-16 12:52 ` [PATCH v3 35/52] xen/drivers/passthrough/vtd/dmar.c: " Juergen Gross
2017-08-16 12:52 ` [PATCH v3 36/52] xen/drivers/passthrough/vtd/quirks.c: " Juergen Gross
2017-08-16 12:52 ` [PATCH v3 37/52] xen/drivers/video/vesa.c: " Juergen Gross
2017-08-16 12:52 ` [PATCH v3 38/52] xen/xsm/flask/flask_op.c: " Juergen Gross
2017-08-16 12:52 ` [PATCH v3 39/52] xen: check parameter validity when parsing command line Juergen Gross
2017-08-22 11:24 ` Jan Beulich
[not found] ` <599C307A0200007800171EFF@suse.com>
2017-08-23 9:30 ` Juergen Gross
2017-08-23 9:38 ` Jan Beulich
2017-08-23 12:42 ` Juergen Gross
2017-08-23 13:18 ` Jan Beulich
[not found] ` <599D9CC10200007800172970@suse.com>
2017-08-23 14:21 ` Juergen Gross
2017-08-23 14:38 ` Jan Beulich
2017-08-16 12:52 ` [PATCH v3 40/52] xen/arch/x86/apic.c: remove custom_param() error messages Juergen Gross
2017-08-16 12:52 ` [PATCH v3 41/52] xen/arch/x86/cpu/mcheck/mce.c: " Juergen Gross
2017-08-16 12:52 ` [PATCH v3 42/52] xen/arch/x86/hvm/viridian.c: " Juergen Gross
2017-08-16 12:52 ` [PATCH v3 43/52] xen/arch/x86/io_apic.c: " Juergen Gross
2017-08-16 12:52 ` [PATCH v3 44/52] xen/common/kexec.c: " Juergen Gross
2017-08-16 12:52 ` [PATCH v3 45/52] xen/common/sched_credit2.c: " Juergen Gross
2017-08-16 12:52 ` [PATCH v3 46/52] xen: carve out a generic parsing function from _cmdline_parse() Juergen Gross
2017-08-16 12:52 ` [PATCH v3 47/52] xen: add basic support for runtime parameter changing Juergen Gross
2017-08-22 11:27 ` Jan Beulich
2017-08-16 12:52 ` [PATCH v3 48/52] xen: add hypercall for setting parameters at runtime Juergen Gross
2017-08-22 11:31 ` Jan Beulich
[not found] ` <599C32330200007800171F47@suse.com>
2017-08-23 9:52 ` Juergen Gross
2017-08-23 10:02 ` Jan Beulich
2017-08-16 12:52 ` [PATCH v3 49/52] libxc: add function to set hypervisor parameters Juergen Gross
2017-08-22 14:15 ` Wei Liu
2017-08-16 12:52 ` [PATCH v3 50/52] libxl: add libxl_set_parameters() function Juergen Gross
2017-08-22 14:15 ` Wei Liu
2017-08-16 12:52 ` [PATCH v3 51/52] xl: add new xl command set-parameters Juergen Gross
2017-08-16 12:52 ` [PATCH v3 52/52] xen: make some console related parameters settable at runtime Juergen Gross
2017-08-22 11:33 ` Jan Beulich
2017-08-22 14:16 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20fcf7ae5e924d3d8f7299a318b6c356@AMSPEX02CL03.citrite.net \
--to=paul.durrant@citrix.com \
--cc=Andrew.Cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).