lkmpg/examples
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
..
other Enforce consistent style for directory "other" (#89) 2021-09-02 16:26:29 +08:00
.clang-format Enforce Linux kernel coding style (#88) 2021-09-02 15:15:07 +08:00
bottomhalf.c Fix the warnings raised by Sparse (#92) 2021-09-04 17:53:29 +08:00
chardev.c Fix potential concurrent access problems with VFS (#108) 2021-09-23 12:20:10 +08:00
chardev.h Enforce Linux kernel coding style (#88) 2021-09-02 15:15:07 +08:00
chardev2.c Fix potential concurrent access problems with VFS (#108) 2021-09-23 12:20:10 +08:00
completions.c Fix the warnings raised by Sparse (#92) 2021-09-04 17:53:29 +08:00
cryptosha256.c Fix the warnings raised by Sparse (#92) 2021-09-04 17:53:29 +08:00
cryptosk.c Fix the warnings raised by Sparse (#92) 2021-09-04 17:53:29 +08:00
devicemodel.c Enforce Linux kernel coding style (#88) 2021-09-02 15:15:07 +08:00
example_atomic.c CI: Run static analysis with Cppcheck (#105) 2021-09-14 00:52:04 +08:00
example_mutex.c Fix the warnings raised by Sparse (#92) 2021-09-04 17:53:29 +08:00
example_rwlock.c Fix the warnings raised by Sparse (#92) 2021-09-04 17:53:29 +08:00
example_spinlock.c Fix the warnings raised by Sparse (#92) 2021-09-04 17:53:29 +08:00
example_tasklet.c Fix the warnings raised by Sparse (#92) 2021-09-04 17:53:29 +08:00
hello-1.c Mention pr_info() rather than KERN_INFO 2021-08-16 21:53:22 +02:00
hello-2.c Enforce Linux kernel coding style (#88) 2021-09-02 15:15:07 +08:00
hello-3.c Enforce Linux kernel coding style (#88) 2021-09-02 15:15:07 +08:00
hello-4.c Enforce Linux kernel coding style (#88) 2021-09-02 15:15:07 +08:00
hello-5.c Enforce Linux kernel coding style (#88) 2021-09-02 15:15:07 +08:00
hello-sysfs.c Enforce Linux kernel coding style (#88) 2021-09-02 15:15:07 +08:00
intrpt.c Enforce Linux kernel coding style (#88) 2021-09-02 15:15:07 +08:00
ioctl.c CI: Run static analysis with Cppcheck (#105) 2021-09-14 00:52:04 +08:00
kbleds.c CI: Introduce Smatch for static analysis (#125) 2021-11-01 08:20:41 +08:00
Makefile CI: introduce GCC static analysis 2021-10-08 19:41:22 +08:00
print_string.c Enforce Linux kernel coding style (#88) 2021-09-02 15:15:07 +08:00
procfs1.c Fix the warnings raised by Sparse (#92) 2021-09-04 17:53:29 +08:00
procfs2.c CI: Introduce Smatch for static analysis (#125) 2021-11-01 08:20:41 +08:00
procfs3.c Fix the warnings raised by Sparse (#92) 2021-09-04 17:53:29 +08:00
procfs4.c suppress warning: no newline at end of file 2021-09-08 22:23:02 +08:00
sched.c Enforce Linux kernel coding style (#88) 2021-09-02 15:15:07 +08:00
sleep.c Avoid unexpected concurrent access (#94) 2021-09-07 23:42:06 +08:00
start.c Apply editorial changes 2021-08-08 01:24:59 +08:00
stop.c Fix the warnings raised by Sparse (#92) 2021-09-04 17:53:29 +08:00
syscall.c Fix the warnings raised by Sparse (#92) 2021-09-04 17:53:29 +08:00