Re: [PATCH] lib/cmdline.c: add to the get_options() documentation
From: Dan Carpenter
Date: Mon Aug 21 2017 - 07:51:34 EST
On Mon, Aug 21, 2017 at 02:42:52PM +0400, Ilya Matveychikov wrote:
>
> > On Aug 21, 2017, at 1:46 PM, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> >
> > I wasn't sure how get_options() worked, so I looked at examples. And by
> > sheer chance the first example I picked the only example which uses it
> > incorrectly... I've added some comments that hopefully help.
> >
>
> See also comments on my patch from Ben Hutchings:
> https://patchwork.kernel.org/patch/9811617/
Ugh... The implementation of get_options() looks gnarly, yes. That
affects the part of my comment which says:
+ * string. It stores the number of numbers as the first element in the
+ * array.
If we are going to keep the current behavior then we should specify that
ints[0] can be higher than "nints - 1". But I feel like the current
behavior is wrong and that get_range() should never return more than n.
regards,
dan carpenter