Commit Graph

7 Commits

Author SHA1 Message Date
Chih-En Lin
e2e8e1106d
CI: Fix "unreplaced" warnings by using git source (#229)
Because of sparse-latest.tar.gz has not been updated since 06-Sep-2021,
we are encoutering an old bug, 0e1aae55e49c ("fix "unreplaced" warnings
caused by using typeof() on inline functions") [1], that has been fixed
in the newest version. So, let's switch to the git source tree [2]
instead of using sparse-latest.tar.gz [3].

[1] https://git.kernel.org/pub/scm/devel/sparse/sparse.git/commit/?id=0e1aae55e49cad7ea43848af5b58ff0f57e7af99
[2] git://git.kernel.org/pub/scm/devel/sparse/sparse.git
[3] http://www.kernel.org/pub/software/devel/sparse/dist/sparse-latest.tar.gz
2023-09-17 18:09:48 +08:00
Chih-En Lin
16e0656b2d CI: Switch Smatch source code to GitHub mirror
Since the Smatch repository is unavailable recently [1], let's switch
to GitHub mirror, https://github.com/error27/smatch.git [2], instead
of using https://repo.or.cz/smatch.git.

[1] https://lore.kernel.org/all/Y1qf7w%2Fjo8FH5I8G@kadam/
[2] https://lore.kernel.org/all/20220810105926.GS3460@kadam/
2023-05-01 23:36:23 +08:00
Jim Huang
1c916a79a9 CI: Bump validation host versioning
The CI is now running on Ubuntu 22.04-LTS along with gcc-11 and
clang-format-12 .
2022-12-10 06:21:02 +08:00
linD026
6b6b6635cf
CI: Introduce Smatch for static analysis (#125)
Smatch[1][2] is a pluggable static analysis for C. It may help us find
out the potential problem of the example code.

Doing with smatch, if set the --file-output flag, it will generate the
{}.c.smatch report for each c file. This will make a little bit
complicated to collect all the report messages. So, here we stay at the
default setting, stdout for the smatch messages.

For more information, see:
- https://lwn.net/Articles/696624/
- https://elinux.org/images/d/d3/Bargmann.pdf

Also, fix the warning from Smatch:

Smatch failed: 1 warning(s), 1 error(s)
lkmpg/examples/procfs2.c:57 procfile_write() error: buffer overflow 'procfs_buffer' 1024 <= 1024
lkmpg/examples/kbleds.c:58 kbleds_init() warn: argument 5 to %lx specifier is cast from pointer

Furthermore, the effect of the write operation in procfs2.c is too
implied. So after writing, print the buffer every time.

Close #122

[1] https://github.com/error27/smatch
[2] https://repo.or.cz/w/smatch.git
2021-11-01 08:20:41 +08:00
linD026
d6e1044aa7 CI: introduce GCC static analysis
Since GCC version 10, there has been a new option -fanalyzer for
static analysis. It can make the CI pipeline more comprehensive.

Also, the static analysis updates in GCC 11, but we cannot install
the GCC 11 in ubuntu 20.04 straightforwardly right now, which is
the GitHub workflow environment (see status-check.yaml).
For this reason, we stay at the GCC 10.

Close #117

Reference
- https://gcc.gnu.org/onlinedocs/gcc-10.1.0/gcc/Static-Analyzer-Options.html
- https://developers.redhat.com/blog/2020/03/26/static-analysis-in-gcc-10
- https://lwn.net/Articles/870290/
- https://developers.redhat.com/blog/2021/01/28/static-analysis-updates-in-gcc-11
- 7d73c3e9c5
2021-10-08 19:41:22 +08:00
linD026
25d82ec47f CI: Integrate the Sparse into the CI pipeline
Sparse[1] is a semantic parser for C language, it can find out the
potential problem of the example code.

[1] https://www.kernel.org/doc/html/latest/dev-tools/sparse.html
2021-09-15 12:43:56 +08:00
linD026
5070fcd9d0
CI: Run static analysis with Cppcheck (#105)
Cppcheck[1] is integrated into CI pipeline for running static analysis.

However, Cppcheck is known to report false-positive, and we have to
suppress some warnings in advance.

[1] https://cppcheck.sourceforge.io/
2021-09-14 00:52:04 +08:00