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

Re: [Xen-devel] [PATCH v2] xen/cmdline: Fix buggy strncmp(s, LITERAL, ss - s) construct



>>> On 07.01.19 at 18:28, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 07/01/2019 08:59, Jan Beulich wrote:
>>> @@ -271,6 +297,27 @@ int parse_boolean(const char *name, const char *s, 
> const char *e)
>>>      return -1;
>>>  }
>>>  
>>> +int cmdline_strcmp(const char *frag, const char *name)
>> So you've decided to retain the strcmp()-like return type and value,
>> despite them being of no interest to any caller, and it being
>> vanishingly unlikely for a caller to appear which would care. Fine
>> for now, but I'd still like to understand why.
> 
> You already asked this, and give no objection to my answer, I presumed
> you were satisfied with the concrete usecase I gave, citing a patch
> needing this behaviour which has already been posted to the list.

Well, for one I admit I didn't recall this answer of yours. Perhaps
largely because that (to me) was referring to yet to be posted
code, as (obviously) you can't have used cmdline_strcmp() there.
Now that you say this was posted already (with strncmp()
presumably), I can only remind you that ...

> <bff3c33d-a244-362a-529c-32f91b5f3965@xxxxxxxxxx>

... neither my mail client nor the list archives allow me to search
for such a mail ID. Anyway - whether that binary searching is
reasonable in the first place depends heavily on when / how the
corresponding sorting gets done. Obviously the comparisons
used have to fully match up. If both use the C rules, that's fine
in an abstract sense (because locale setting ought to not matter),
but it would be better if both actually used the same piece of
(binary) code.

In any event I'm not convinced this is proper justification for the
function here to behave strcmp()-like; that special purpose code
could as well tokenize its strings and use strcmp().

FAOD, none of the above is meant to invalidate my R-b.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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