From: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
To: Chen Yu <yu.c.chen@intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Ian Rogers <irogers@google.com>,
Athira Rajeev <atrajeev@linux.vnet.ibm.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
acme@redhat.com, Fernand Sieber <sieberf@amazon.com>,
linux-perf-users <linux-perf-users@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Subject: Re: [PATCH v3] perf sched map: Add command-name, fuzzy-name options to filter the output map
Date: Tue, 18 Jun 2024 22:00:39 +0530 [thread overview]
Message-ID: <f6af24a0-4a00-4d06-bff9-50d78bdd9b23@linux.ibm.com> (raw)
In-Reply-To: <ZnGRDyWrAUHnghtb@chenyu5-mobl2>
Hi Chen Yu,
On 18/06/24 19:22, Chen Yu wrote:
> On 2024-06-17 at 18:19:30 +0530, Madadi Vineeth Reddy wrote:
>
>> +static struct CommandList *parse_commands(const char *commands)
>> +{
>> + char *commands_copy = strdup(commands);
>
> Should we check if commands_copy is NULL in case of allocation failure?
>
Thank you for the suggestion. I will fix it and send a v4.
Thanks and Regards
Madadi Vineeth Reddy
>> + char *token = strtok(commands_copy, ",");
>> + struct CommandList *cmd_list = malloc(sizeof(struct CommandList));
>> +
>> + if (cmd_list == NULL)
>> + return NULL;
>> +
>> + cmd_list->command_count = 0;
>> + cmd_list->command_list = NULL;
>> +
>> + while (token != NULL) {
>> + cmd_list->command_list = realloc(cmd_list->command_list, sizeof(char *)
>> + *(cmd_list->command_count + 1));
>> + cmd_list->command_list[cmd_list->command_count] = strdup(token);
>
> ditto.
>
> thanks,
> Chenyu
prev parent reply other threads:[~2024-06-18 16:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-17 12:49 Madadi Vineeth Reddy
2024-06-18 13:52 ` Chen Yu
2024-06-18 16:30 ` Madadi Vineeth Reddy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f6af24a0-4a00-4d06-bff9-50d78bdd9b23@linux.ibm.com \
--to=vineethr@linux.ibm.com \
--cc=ZnGRDyWrAUHnghtb@chenyu5-mobl2.dal12v.mail.ibm.com \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=sieberf@amazon.com \
--cc=yu.c.chen@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®