Re: [GIT PULL -tip] fix 41 'make headers_check' warnings

From: Ingo Molnar
Date: Sun Jan 18 2009 - 07:26:50 EST



* Jaswinder Singh Rajput <jaswinder@xxxxxxxxxx> wrote:

> On Sun, 2009-01-18 at 12:02 +0100, Ingo Molnar wrote:
> > * Jaswinder Singh Rajput <jaswinder@xxxxxxxxxx> wrote:
> >
> > > diff --git a/include/linux/acct.h b/include/linux/acct.h
> > > index 882dc72..a20c97c 100644
> > > --- a/include/linux/acct.h
> > > +++ b/include/linux/acct.h
> > > @@ -59,9 +59,13 @@ struct acct
> > > comp_t ac_majflt; /* Major Pagefaults */
> > > comp_t ac_swaps; /* Number of Swaps */
> > > /* m68k had no padding here. */
> > > -#if !defined(CONFIG_M68K) || !defined(__KERNEL__)
> > > +#ifdef __KERNEL__
> > > +#ifndef CONFIG_M68K
> > > __u16 ac_ahz; /* AHZ */
> > > -#endif
> > > +#endif /* CONFIG_M68K */
> > > +#else /* __KERNEL__ */
> > > + __u16 ac_ahz; /* AHZ */
> > > +#endif /* __KERNEL__ */
> >
> > that looks rather ugly.
> >
> > Why not just flip it around to:
> >
> > #if !defined(__KERNEL__) || !defined(CONFIG_M68K)
> >
> > ? Does headers_check misinterpret that?
> >
>
> This will not many any difference:
> then usr/include/linux/acct.h will look like:
> #if !defined(__KERNEL__) || !defined(CONFIG_M68K)
> __u16 ac_ahz; /* AHZ */
> #endif
>
> And we will get same warning:
> usr/include/linux/acct.h:62: leaks CONFIG_M68K to userspace where it is not valid

which would be a false positive. Sam, what would be your preference to
annotate the code in such cases?

> > i.e. always provide the wider type to user-space.
>
> Sorry, this will not be helpful we will still get the warning.

the problem here is that the type you export to user-space is the _wrong_
(narrow) type. Including types.h is one thing - exporting something to
user-space is another thing. It might not matter in practice.

Furthermore, the 3 blocks are there as well - while there should only be
two.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/