Re: [PATCH 18/25] dynamic_debug: describe_flags with '=[pmflta_]*'

Jim Cromie
2011-07-27T17:28:50Z

On Tue, Jul 26, 2011 at 1:37 AM, Bart Van Assche <bvanassche@acm.org> wrote:
> On Mon, Jul 25, 2011 at 11:42 PM, Jim Cromie <jim.cromie@gmail.com> wrote:
>> Change describe_flags() to emit '=[pmflta_]+' for current callsite
>> flags, or just '=_' when they're disabled.  Having '=' in output
>> allows a more selective grep expression, in contrast '-' may appear
>> in filenames, line-ranges, and format-strings.  '=' also has better
>> mnemonics, saying; "the current setting are equal to <flags>".
>>
>> The default allows grep "=_" <dbgfs>/dynamic_debug/control
>> to see disabled callsites while avoiding the many occurrences of " = "
>> seen in format strings.
>>
>> Signed-off-by: Jim Cromie <jim.cromie@gmail.com>

>> @@ -102,11 +103,12 @@ static char *ddebug_describe_flags(struct _ddebug *dp, char *buf,
>>        int i;
>>
>>        BUG_ON(maxlen < 4);
>> +       *p++ = '=';
>>        for (i = 0; i < ARRAY_SIZE(opt_array); ++i)

>
> The "BUG_ON(maxlen < 4)" tests whether a buffer overflow can occur
> before starting to write in the buffer. Since the above code affects
> the number of characters that can be written in the output buffer,
> shouldn't that statement be updated or replaced ?
>
> Bart.
>

Ack.
Ive just enlarged buffer and check to 10.
strictly, only 9 is needed, but Im feeling generous.

thanks for the close reading.

updated git://github.com/jimc/linux-2.6.git dyndbg-next