[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 19/53] xen/arch/x86/psr.c: let custom parameter parsing routines return errno



On 25/08/17 10:17, Jan Beulich wrote:
>>>> On 24.08.17 at 18:27, <jgross@xxxxxxxx> wrote:
>> On 24/08/17 17:35, Jan Beulich wrote:
>>>>>> On 23.08.17 at 19:34, <jgross@xxxxxxxx> wrote:
>>>> --- a/xen/arch/x86/psr.c
>>>> +++ b/xen/arch/x86/psr.c
>>>> @@ -418,50 +418,66 @@ static const struct feat_props l2_cat_props = {
>>>>      .write_msr = l2_cat_write_msr,
>>>>  };
>>>>  
>>>> -static void __init parse_psr_bool(char *s, char *value, char *feature,
>>>> +static bool __init parse_psr_bool(const char *s, const char *value,
>>>> +                                  const char *ss, const char *feature,
>>>>                                    unsigned int mask)
>>>>  {
>>>> -    if ( !strcmp(s, feature) )
>>>> +    if ( !strncmp(s, feature, value - s) )
>>>>      {
>>>> -        if ( !value )
>>>> +        if ( !*value )
>>>>              opt_psr |= mask;
>>>>          else
>>>>          {
>>>> -            int val_int = parse_bool(value, NULL);
>>>> +            int val_int = parse_bool(value + 1, ss);
>>>
>>> Why "+ 1" here?
>>
>> value points to the delimiter ('\0' or ',') now.
> 
> That's pretty counterintuitive and error prone, don't you think?
> At the very least the parameter then shouldn't be called "value".

Okay, I'll rename it to "delim".


Juergen

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.