On Fri, 20 Oct 2006 17:15:44 +0400
Alexey Dobriyan <[email protected]> wrote:
> Make it break or warn if you pass to spin_lock_irqsave() and friends
> something different from "unsigned long flags;". Suprisingly large amount of
> these was caught by recent commit c53421b18f205c5f97c604ae55c6a921f034b0f6 .
>
> Idea is largely from FRV typechecking.
>
> Note #1: checking with sparse is still needed, because a driver can save and
> pass around flags or something. So far patch is very intrusive.
> Note #2: techically, we should break only if sizeof(flags) < sizeof(unsigned long),
> but hey, there is opportunity to escalate. Thus !=
> Note #3: yes, would break every single buggy out-of-tree module.
>
This is a pretty ugly-looking patch.
>
> + BUILD_BUG_ON(sizeof(flags) != sizeof(unsigned long)); \
> + typecheck(unsigned long, flags); \
> ...
> + BUILD_BUG_ON(sizeof(flags) != sizeof(unsigned long)); \
> + typecheck(unsigned long, flags); \
> ...
> + BUILD_BUG_ON(sizeof(flags) != sizeof(unsigned long)); \
> + typecheck(unsigned long, flags); \
> ...
> + BUILD_BUG_ON(sizeof(flags) != sizeof(unsigned long)); \
> + typecheck(unsigned long, flags); \
> ...
> + BUILD_BUG_ON(sizeof(flags) != sizeof(unsigned long)); \
> + typecheck(unsigned long, flags); \
> ...
starting to see a pattern here?
If we're going to do this then a helper macro build_check_irq_flags() would
help clean things up. It will also allow us to centralise the
warning-vs-error policy decision.
I'm not sure that we need both, do we? If it spits a warning then it'll
get fixed soon enough.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]