[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f6af24a0-4a00-4d06-bff9-50d78bdd9b23@linux.ibm.com>
Date: Tue, 18 Jun 2024 22:00:39 +0530
From: Madadi Vineeth Reddy <vineethr@...ux.ibm.com>
To: Chen Yu <yu.c.chen@...el.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>, Ian Rogers <irogers@...gle.com>,
Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>,
Kan Liang <kan.liang@...ux.intel.com>, acme@...hat.com,
Fernand Sieber <sieberf@...zon.com>,
linux-perf-users <linux-perf-users@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Madadi Vineeth Reddy <vineethr@...ux.ibm.com>
Subject: Re: [PATCH v3] perf sched map: Add command-name, fuzzy-name options
to filter the output map
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
Powered by blists - more mailing lists