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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150227135727.GH13373@kernel.org>
Date:	Fri, 27 Feb 2015 10:57:27 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	Yunlong Song <yunlong.song@...wei.com>
Cc:	a.p.zijlstra@...llo.nl, paulus@...ba.org, mingo@...hat.com,
	linux-kernel@...r.kernel.org, wangnan0@...wei.com
Subject: Re: [PATCH v3 1/7] perf list: Sort the output of 'perf list' to view
 more clearly

Em Fri, Feb 27, 2015 at 06:21:25PM +0800, Yunlong Song escreveu:
> Sort the output according to ASCII character list (using strcmp), which
> supports both number sequence and alphabet sequence.

That is a great feature to have, thanks!

But you are not calling closedir() if zalloc fails, I am fixing that for
you this time, please check those kinds of things in the future.

- Arnaldo
> @@ -1100,11 +1108,21 @@ void print_tracepoint_events(const char *subsys_glob, const char *event_glob,
>  	struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
>  	char evt_path[MAXPATHLEN];
>  	char dir_path[MAXPATHLEN];
> +	char **evt_list = NULL;
> +	unsigned int evt_i = 0, evt_num = 0;
> +	bool evt_num_known = false;
>  
> +restart:
>  	sys_dir = opendir(tracing_events_path);
>  	if (!sys_dir)
>  		return;
>  
> +	if (evt_num_known) {
> +		evt_list = zalloc(sizeof(char *) * evt_num);
> +		if (!evt_list)
> +			goto out_enomem;

Here, zalloc fails, goto out_enomem, closedir() not called.

> +out_free:
> +	evt_num = evt_i;
> +	for (evt_i = 0; evt_i < evt_num; evt_i++)
> +		zfree(&evt_list[evt_i]);
> +	zfree(&evt_list);
> +	return;
> +
> +out_enomem:
> +	printf("FATAL: not enough memory to print %s\n",
> +			event_type_descriptors[PERF_TYPE_TRACEPOINT]);
> +	if (evt_list)
> +		goto out_free;
>  }
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ