User Tools

Site Tools


mywiki:linux:linux_code_sparse_test_anaylysis

Table of Contents

Linux Code Sparse Test/Analysis

klockwork

Sparse

Get sparse

  You can get sparse from git://git.kernel.org/pub/scm/devel/sparse/sparse.git

Using sparse

To use sparse for kernel development simply pass on the C=1 argument onto your make command. For example to enable sparse for mac80211 development you would use:

  make C=1 M=net/mac80211/

Endian checks

Endian checks are encouraged. Most endian complaints are typically valid and reflect design issues. These should be reviewed carefully. Some drivers force-enable endian checks with sparse by forcing it through their own driver makefiles upstream. If drivers do not have these you can enable sparse checks yourself by appending to your make command:

  CF="-D__CHECK_ENDIAN__" 

To enforce endian checks on your driver you can use something as follows on your driver Makefile:

  ccflags-y += -D__CHECK_ENDIAN__
mywiki/linux/linux_code_sparse_test_anaylysis.txt · Last modified: by 127.0.0.1