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]
Date:	Sat, 14 Apr 2012 14:15:46 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Sasha Levin <levinsasha928@...il.com>
Cc:	akpm@...ux-foundation.org, peterz@...radead.org, mingo@...e.hu,
	hpa@...or.com, tglx@...utronix.de,
	srivatsa.bhat@...ux.vnet.ibm.com, linux-kernel@...r.kernel.org
Subject: Re: [RFC 2/3] sched: add type checks to for_each_cpu_mask()

On Sat, Apr 14, 2012 at 3:14 PM, Sasha Levin <levinsasha928@...il.com> wrote:
> -#define for_each_cpu_mask(cpu, mask)   \
> +#define for_each_cpu_mask(cpu, mask)           \
> +       typecheck(struct cpumask *, (mask));    \
>        for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)

Stuff like this is *WRONG*.

You now totally broke

  if (xyzzy)
    for_each_cpu_mask() {
    }

because you turned the loop into two separate statements.

If this is needed, it needs to be done right. You could have done it by doing

  #define for_each_cpu_mask(cpu, mask)           \
      for (typecheck(struct cpumask *, (mask)), (cpu) = 0; (cpu) < 1; (cpu)++)

or similar (I think you can drop the (void)(mask) because the variable
is now used by the typecheck macro).

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