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:   Tue, 7 Mar 2023 18:52:11 +0100
From:   "Jason A. Donenfeld" <Jason@...c4.com>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 5/5] cpumask: fix comment of cpumask_xxx

Hi Linus,

On Mon, Mar 6, 2023 at 10:28 PM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> I'm looking at wg_cpumask_next_online(), and this:
>
>         while (unlikely(!cpumask_test_cpu(cpu, cpu_online_mask)))
>                 cpu = cpumask_next(cpu, cpu_online_mask) % nr_cpumask_bits;
>
> seems very dodgy indeed. I'm not convinced it might not cause an endless loop.

Indeed this code is crap and wrong in multiple ways. I can probably
simplify to something like

static inline int wg_cpumask_next_online(int *last_cpu)
{
        int cpu = cpumask_next(*last_cpu, cpu_online_mask);
        if (cpu >= nr_cpu_ids)
                cpumask_first(cpu_online_mask);

as you suggested, which is indeed a lot more straightforward.

I'll get this all cleaned up.

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ