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:	Thu, 21 Jun 2012 20:33:38 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	David Rientjes <rientjes@...gle.com>, Mel Gorman <mgorman@...e.de>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Ingo Molnar <mingo@...e.hu>
Subject: Re: [patch 3.5-rc3] mm, mempolicy: fix mbind() to do synchronous migration

On Thu, Jun 21, 2012 at 6:45 PM, Andrew Morton
<akpm@...ux-foundation.org> wrote:
>
>> I wonder if I should make sparse warn about any casts to/from enums.
>> They tend to always be wrong.
>
> I think it would be worth trying, see how much fallout there is.  Also
> casts from "enum a" to "enum b".  We've had a few of those,
> unintentionally.

Ugh. We have this all over. Well, at least in multiple places.

Like <linux/personality.h>, which does things like

        PER_LINUX_32BIT =       0x0000 | ADDR_LIMIT_32BIT,

where PER_LINUX_32BIT is one enum, and ADDR_LIMIT_32BIT is a different one.

And things like

        WORK_STRUCT_PENDING     = 1 << WORK_STRUCT_PENDING_BIT,

in <linux/workqueue.h> is similar.

Sure, my quick warning generator gives lots of extraneous warnings,
and it complains about the above kind of "mixing enum with int"
behavior, but the above is a very real example of casting an enum to
an integer. And we *want* it to happen in the above cases.

I'll see what it looks like if I only warn about casting *to* an enum.

             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

Powered by Openwall GNU/*/Linux Powered by OpenVZ