sudo apt-get install sparse
How to use sparse
Choose a subdirectory in the kernel tree that you want to check for sparse warnings and errors, for instance that could be drivers/staging/wlan-ng, and do:
$ make C=2 drivers/staging/wlan-ng/
You can use the variable CF to pass more checkflags to sparse. For example, you can enable endian checks doing:
$ make C=2 CF="-D__CHECK_ENDIAN__" drivers/staging/wlan-ng/
The warnings produced indicate sites in code where types relevant to byteorder are mixed, possibly leading to buggy behavior.
You can observe what are the default checkflags set in the Makefile. You will see something close to the following:
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ -Wbitwise -Wno-return-void $(CF)
http://jake.dothome.co.kr/sparse/
* smatch ??
http://smatch.sourceforge.net/
http://events.linuxfoundation.org/sites/events/files/slides/Static%20code%20checking.pdf
No comments:
Post a Comment