lkmpg/examples
linD026 1a6fb67cf2
Fix potential concurrent access problems with VFS (#108)
Since Linux v3.14, the read, write and seek operations of "struct file" are
guaranteed for thread safety [1][2]. This patch added an explanation.

Here are the potential problems:
chardev.c:
- Move the "msg_ptr" pointer into the read function to remove unnecessary usage.
- List the clear states of "already_open" by using mnemonic enumeration.

chardev2.c:
- The "buffer" in the write function is user space data. It cannot use in the
  kernel space.
- Reduce the redundant type transformation.
- List the states of "already_open". Same as chardev.c.

[1] https://lore.kernel.org/lkml/20140303210359.26624.qmail@science.horizon.com/T/#u
[2] 9c225f2655
2021-09-23 12:20:10 +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 Adapt the timer API Usage (#98) 2021-09-10 12:29:48 +08:00
Makefile Improve CI pipeline to automate module testing (#95) 2021-09-08 20:38:50 +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 Fix the warnings raised by Sparse (#92) 2021-09-04 17:53:29 +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