Re: [PATCH] lockdep: fix spurious 'inconsistent lock state' warning

Ingo Molnar
2008-08-18T07:42:46Z

* Dmitry Baryshkov <dbaryshkov@gmail.com> wrote:

> Since f82b217e3513fe3af342c0f3ee1494e86250c21c lockdep can output
> spurious warnings related to hwirqs due to hardirq_off shrinkage from
> int to bit-sized flag. Guard it with double negation to fix the
> warning.
>
> Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>

good spotting! Applied to tip/core/urgent, thanks Dmitry.

I'm wondering, is there any way to teach gcc some sanity here - a safer
variant of bitfields, that is just not allowed to overflow into or
corrupt nearby fields? The fact that a benign looking hlock->state = 15
can corrupt other fields worries me quite a bit. Valid C semantics or
not, this is a totally dangerous construct. The space savings are very
real though, so it would be nice to get 'safer bitfields', somehow.

Ingo