threads / patch / 41928

patchapi-trace.txt: fix typo

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

## tl;dr

3 messages between Apr 5, 2016 and Apr 5, 2016. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

Elia Pinto· Apr 5, 2016, 10:05 UTC · lore
The correct api is trace_printf_key
Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 Documentation/technical/api-trace.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to Documentation/technical/api-trace.txt +1 −1
diff --git a/Documentation/technical/api-trace.txt b/Documentation/technical/api-trace.txt
index 389ae16..45a0ecd 100644
--- 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(&trace_foo, message);
+	trace_printf_key(&trace_foo, message);
 }
 ------------
 +
-- 
2.8.0.270.g9d4de1f.dirty
Eric Sunshine· Apr 5, 2016, 17:15 UTC · re: Elia Pinto · lore

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

On Tue, Apr 5, 2016 at 6:05 AM, Elia Pinto <gitter.spiros@gmail.com> wrote:
Show 11 quoted lines
> The correct api is trace_printf_key
>
> Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
> ---
> 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(&trace_foo, message);
> +       trace_printf_key(&trace_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(&trace_foo, "%s", message);
Junio C Hamano· Apr 5, 2016, 20:49 UTC · re: Eric Sunshine · lore

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

Eric Sunshine <sunshine@sunshineco.com> writes:
Show 19 quoted lines
> On Tue, Apr 5, 2016 at 6:05 AM, Elia Pinto <gitter.spiros@gmail.com> wrote:
>> The correct api is trace_printf_key
>>
>> Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
>> ---
>> 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(&trace_foo, message);
>> +       trace_printf_key(&trace_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(&trace_foo, "%s", message);
Thanks, will squash in.

← back to recent threads