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: <1405665795.17297.5.camel@concordia>
Date:	Fri, 18 Jul 2014 16:43:15 +1000
From:	Michael Ellerman <mpe@...erman.id.au>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	jolsa@...hat.com, linux-kernel@...r.kernel.org,
	namhyung@...nel.org, acme@...radead.org,
	Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 06/11] perf, tools: Automatically look for event file
 name for cpu

On Fri, 2014-07-11 at 16:59 -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@...ux.intel.com>
> 
> When no JSON event file is specified automatically look
> for a suitable file in ~/.cache/pmu-events. A "perf download" can
> automatically add files there for the current CPUs.
... 

> diff --git a/tools/perf/arch/x86/util/header.c b/tools/perf/arch/x86/util/header.c
> index 146d12a..76e0ece 100644
> --- a/tools/perf/arch/x86/util/header.c
> +++ b/tools/perf/arch/x86/util/header.c
> @@ -57,3 +58,15 @@ get_cpuid(char *buffer, size_t sz)
>  	}
>  	return -1;
>  }
> +
> +int get_cpuid(char *buffer, size_t sz)
> +{
> +	return __get_cpuid(buffer, sz, "%s,%u,%u,%u$");
> +}
> +
> +char *get_cpu_str(void)
> +{
> +	char *buf = malloc(128);

I realise malloc failure is unlikely, but it's not impossible right?

Seems like it'd be cleaner if the caller allocated the buffer.

> +	__get_cpuid(buf, 128, "%s-%d-%X-core");
> +	return buf;
> +}

cheers


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