Re: Many warnings from our userspace headers



On Tue, Dec 30, 2008 at 11:43:22AM +0100, Andreas Schwab wrote:
Sam Ravnborg <sam@xxxxxxxxxxxx> writes:

/home/sam/kernel/knext.git/usr/include/linux/acct.h:62: leaks CONFIG_M68K to userspace where it is not valid

IMHO this is a false positive, since it is protected by __KERNEL__ in
the same expression.

Correct - but we can rewrite it like this:

diff --git a/include/linux/acct.h b/include/linux/acct.h
index 882dc72..bcc6d2f 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -59,8 +59,12 @@ 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__)
+#ifndef __KERNEL__
__u16 ac_ahz; /* AHZ */
+#else
+ #ifndef CONFIG_M68K
+ __u16 ac_ahz; /* AHZ */
+ #endif
#endif
__u32 ac_exitcode; /* Exitcode */
char ac_comm[ACCT_COMM + 1]; /* Command Name */

This is at least for me also easier to parse.
So we remove a (bogus) warning and make the code easier to read.

Sam
--
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/



Relevant Pages

  • [PATCH 1/3] lutimesat: simplify utime(2)
    ... Rewrite via do_utimeslike compat_sys_utime. ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Re: [tip:timers/tracing] hrtimer: Add tracepoint for hrtimers
    ... Now I'm trying to parse this with a tool so that we can have something ... s32 nsec, sec; ...
    (Linux-Kernel)
  • [ANN] ParseTree 2.0.0 Released
    ... Uses RubyInline, ... Includes UnifiedRuby, allowing you to automatically rewrite ruby quirks. ... ParseTree#parse_tree_for_string lets you parse arbitrary strings of ruby. ...
    (comp.lang.ruby)
  • Re: test if a string is a valid number?
    ... My code does work, does sell, and doesn't require grotesque solutions. ... I can write an FSM to parse an integer as fast as I can type it in. ... who did quick & dirty solutions ended up having to rewrite their code again and again to ...
    (microsoft.public.vc.mfc)
  • Re: objFSO.FileExists not working?????
    ... if it doesn't parse home.asp again. ... > Kind Regards ... This email account is my spam trap so I don't check it very often. ...
    (microsoft.public.inetserver.asp.general)