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] [day] [month] [year] [list]
Date:   Wed, 6 Jun 2018 12:50:59 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Adrian Hunter <adrian.hunter@...el.com>
Cc:     Andi Kleen <ak@...ux.intel.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Ingo Molnar <mingo@...hat.com>,
        Andy Lutomirski <luto@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Joerg Roedel <joro@...tes.org>, Jiri Olsa <jolsa@...hat.com>,
        linux-kernel@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH V3 02/17] kallsyms, x86: Export addresses of syscall
 trampolines

On Wed, Jun 06, 2018 at 11:02:08AM +0300, Adrian Hunter wrote:
> On 05/06/18 19:00, Andi Kleen wrote:
> >> +#ifdef CONFIG_X86_64
> >> +int arch_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
> >> +		     char *name)
> >> +{
> >> +	unsigned int cpu, ncpu;
> >> +
> >> +	if (symnum >= num_possible_cpus())
> >> +		return -EINVAL;
> >> +
> >> +	for (cpu = cpumask_first(cpu_possible_mask), ncpu = 0;
> >> +	     cpu < num_possible_cpus() && ncpu < symnum;
> >> +	     cpu = cpumask_next(cpu, cpu_possible_mask), ncpu++)
> >> +		;
> > 
> > That is max_t(unsigned, cpumask_last(cpu_possible_mask), symnum)
> 
> I think it should be:
> 
> -	     cpu < num_possible_cpus() && ncpu < symnum;
> +	     ncpu < symnum;

Since we're bike-shedding:

	for_each_possible_cpu(cpu) {
		if (ncpu++ >= symnum)
			break;
	}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ