Re: [PATCH] api-trace.txt: fix typo

2016-04-05 Thread Junio C Hamano
Eric Sunshine  writes:

> On Tue, Apr 5, 2016 at 6:05 AM, Elia Pinto  wrote:
>> The correct api is trace_printf_key
>>
>> Signed-off-by: Elia Pinto 
>> ---
>> diff --git a/Documentation/technical/api-trace.txt 
>> b/Documentation/technical/api-trace.txt
>> @@ -28,7 +28,7 @@ static struct trace_key trace_foo = TRACE_KEY_INIT(FOO);
>>  static void trace_print_foo(const char *message)
>>  {
>> -   trace_print_key(_foo, message);
>> +   trace_printf_key(_foo, message);
>>  }
>
> Since you're touching this already, I wonder if it would make sense to
> rewrite this example to avoid the dangerous sending of an arbitrary
> string (which might contain %) to a printf-like function. Like this,
> for example:
>
> trace_printf_key(_foo, "%s", message);

Thanks, will squash in.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] api-trace.txt: fix typo

2016-04-05 Thread Eric Sunshine
On Tue, Apr 5, 2016 at 6:05 AM, Elia Pinto  wrote:
> The correct api is trace_printf_key
>
> Signed-off-by: Elia Pinto 
> ---
> diff --git a/Documentation/technical/api-trace.txt 
> b/Documentation/technical/api-trace.txt
> @@ -28,7 +28,7 @@ static struct trace_key trace_foo = TRACE_KEY_INIT(FOO);
>  static void trace_print_foo(const char *message)
>  {
> -   trace_print_key(_foo, message);
> +   trace_printf_key(_foo, message);
>  }

Since you're touching this already, I wonder if it would make sense to
rewrite this example to avoid the dangerous sending of an arbitrary
string (which might contain %) to a printf-like function. Like this,
for example:

trace_printf_key(_foo, "%s", message);
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html