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: <20200414122810.4b83ddd2@gandalf.local.home>
Date:   Tue, 14 Apr 2020 12:28:10 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Qais Yousef <qais.yousef@....com>
Cc:     Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Yury Norov <yury.norov@...il.com>,
        Paul Turner <pjt@...gle.com>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Josh Don <joshdon@...gle.com>,
        Pavan Kondeti <pkondeti@...eaurora.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] cpumask: Convert cpumask_any_but() to the new
 random function

On Tue, 14 Apr 2020 16:05:55 +0100
Qais Yousef <qais.yousef@....com> wrote:

> +int cpumask_any_but(const struct cpumask *srcp, unsigned int cpu)
> +{
> +	unsigned int i;
> +
> +	cpumask_check(cpu);
> +
> +	for_each_cpu(i, srcp) {
> +		i = cpumask_any(srcp);

Hmm, if the current CPU is the last CPU in the mask, and cpumask_any()
happens to return it, what happens?

> +		if (i != cpu)
> +			return i;

We loop again, and wouldn't i being the last CPU in the mask cause this
loop to exit, and return nr_cpu_ids?

-- Steve

> +	}
> +
> +	return nr_cpu_ids;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ