Re: [PATCH] Use NULL instead of integer 0 in security/selinux/

From: Geert Uytterhoeven
Date: Sat Jul 10 2004 - 14:44:34 EST


On Fri, 9 Jul 2004, Roman Zippel wrote:
> On Thu, 8 Jul 2004, Linus Torvalds wrote:
> > I have one. It's in my head. It's called the Linux Kernel C standard. Some
> > of it is documented in CodinggStyle, others is just codified in existing
> > practice.
>
> So far we have been quite liberal in style questions, what annoys me here
> is that people send warning patches directly to you without even notifying
> the maintainers. If you want people to conform people to a certain
> CodingStyle please document officially in the kernel, sparse isn't
> distributed with the kernel and the sparse police is silently changing the
> kernel all over the place with sometimes questionable benefit. Only the

I agree, when you're talking about the `if ((x = f())' cases. We already added
the extra parentheses to shut up gcc...

> __user warnings had really found the bugs, but the rest I've seen changes
> perfectly legal code.

Sparse also found the following for me:
- #if NEVER_DEFINED_DEFINE
- `return f();' in a function returning void (where f() returns void as well)
- `retval k_and_r_func(/* missing void */) { ... }'
- `extern' keywords at function definition
- inline functions used before definition
- const pointer assigned to non-const pointer (strange, because usually gcc
tells me as well)
- `if (x &= mask)' instead of `if (x & mask)'
- floating point constants assigned to integers
- `struct x { .field initializer };' (i.e. missing `=')

BTW, the hardest part is adding the __user annotations and making sure
<asm/uaccess.h> does it right (speaking about macros).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
-
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/