Re: Kernel code analysis (was Re: "movb" for spin-unlock (was Re: namei() query))

From: Tigran Aivazian (tigran@veritas.com)
Date: Sat Apr 22 2000 - 11:58:01 EST


On Sat, 22 Apr 2000, Jeff Garzik wrote:
> It is too much to ask "kernel-lint" to puzzle through page cache flag
> arcana for example, but I can think of a ton of simple things that a
> kernel-lint tool could scan for that would be useful..
> * divide by power of two, instead of shifting
> * calling pci_find_xxx functions without pci_enable_device somewhere in
> the driver
> * calling MOD_INC_USE_COUNT in a function AFTER a call to request_irq or
> a similar function which may sleep
> [...]
>
> It's still a tall order to handle simple stuff like this..

indeed a tall order. But what is more simple is perhaps to put these rules
in a text file Documentation/CodingRules and let humans regularly go
through the file and tidy/fix kernel code up if they have time.

To add to the list I would mention things like:

* don't use __initfunc, use __init
* use structure name tags in initializing things like file_operations
* use module_init/module_exit if feasible
[...]

which are not bugs like on your list, but are there to maintain coherent
and uniform state of the kernel code despite it being written by different
humans.

Maybe one could even merge CodingStyle and CodingRules into one? (bad
style is almost a "bug" :)

Regards,
Tigran

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



This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:21 EST