[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANg8OWK4CzLBKnJUd9oa+f5t+5A0htZMORtimcMQgQxcQjzGCw@mail.gmail.com>
Date: Thu, 20 Sep 2012 22:13:40 +0300
From: Irina Tirdea <irina.tirdea@...il.com>
To: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Namhyung Kim <namhyung@...nel.org>
Cc: mingo@...hat.com, acme@...stprotocols.net, a.p.zijlstra@...llo.nl,
rostedt@...dmis.org, paulus@...ba.org, dsahern@...il.com,
namhyung.kim@....com, linux-kernel@...r.kernel.org,
Irina Tirdea <irina.tirdea@...el.com>
Subject: Re: [PATCH 1/4] perf tools: remove sscanf extension %as
>> On Fri, 14 Sep 2012 01:07:40 +0300, Irina Tirdea wrote:
>>> From: Irina Tirdea <irina.tirdea@...el.com>
>>>
>>> perf uses sscanf extension %as to read and allocate a
>>> string in the same step. This is a non-standard extension
>>> only present in new versions of glibc.
>>>
>>> Replacing the use of sscanf and %as with strtok_r calls
>>> in order to parse a given string into its components.
>>> This is needed in Android since bionic does not support
>>> %as extension for sscanf.
>>>
>>> Signed-off-by: Irina Tirdea <irina.tirdea@...el.com>
>>> ---
>>> tools/perf/util/probe-event.c | 25 ++++++++++++++++++-------
>>> tools/perf/util/trace-event-parse.c | 18 ++++++++----------
>>> 2 files changed, 26 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
>>> index 4ce04c2..685ddcf 100644
>>> --- a/tools/perf/util/probe-event.c
>>> +++ b/tools/perf/util/probe-event.c
>>> @@ -1100,6 +1100,7 @@ static int parse_probe_trace_command(const char *cmd,
>>> struct probe_trace_point *tp = &tev->point;
>>> char pr;
>>> char *p;
>>> + char *argv0_str = NULL, *fmt, *fmt1_str, *fmt2_str, *fmt3_str;
>>> int ret, i, argc;
>>> char **argv;
>>>
>>> @@ -1116,14 +1117,19 @@ static int parse_probe_trace_command(const char *cmd,
>>> }
>>>
>>> /* Scan event and group name. */
>>> - ret = sscanf(argv[0], "%c:%a[^/ \t]/%a[^ \t]",
>>> - &pr, (float *)(void *)&tev->group,
>>> - (float *)(void *)&tev->event);
>>> - if (ret != 3) {
>>> + argv0_str = strdup(argv[0]);
>>
>> It seems you need to check return value of strdup.
>
> Agreed.
Thanks for the review! I'll make the fixes and resend the patch.
Irina
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists