lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZnGRDyWrAUHnghtb@chenyu5-mobl2>
Date: Tue, 18 Jun 2024 21:52:15 +0800
From: Chen Yu <yu.c.chen@...el.com>
To: Madadi Vineeth Reddy <vineethr@...ux.ibm.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>, linux-perf-users
	<linux-perf-users@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] perf sched map: Add command-name, fuzzy-name options
 to filter the output map

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?

> +	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

Powered by Openwall GNU/*/Linux Powered by OpenVZ