[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/3] xen/x86: add dom0 memory sizing variants
>>> On 28.11.18 at 16:43, <jgross@xxxxxxxx> wrote: > On 28/11/2018 16:17, Jan Beulich wrote: >>>>> On 22.11.18 at 17:40, <jgross@xxxxxxxx> wrote: >>> @@ -50,7 +55,28 @@ static unsigned long __init parse_amt(const char *s, >>> const char **ps, >>> unsigned long avail) >>> { >>> unsigned int minus = (*s == '-') ? 1 : 0; >>> - unsigned long pages = parse_size_and_unit(s + minus, ps) >> PAGE_SHIFT; >>> + unsigned long val, pages = 0; >>> + >>> + /* Avoid accessing s[-1] in case value starts with '%'. */ >>> + if ( *s == '%' ) >>> + return 0; >>> + >>> + s += minus; >>> + while ( isdigit(*s) ) >>> + { >>> + val = parse_size_and_unit(s, ps); >>> + s = *ps; >>> + if ( *s == '%' && isdigit(*(s - 1)) && val < (100 << 10) ) >> >> In the comment above you talk about s[-1] - why do you use a more >> complicated (even if just slightly) expression here? > > I dislike using s[-1] in code. In case you prefer it I can use it here. It makes more obvious what is meant imo. And we have a number of instances in the tree already. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |