Skip to content

Commit 44b2a3e

Browse files
committed
Fix grammar and typos
1 parent ddca0e0 commit 44b2a3e

9 files changed

Lines changed: 20 additions & 20 deletions

File tree

.ci/static-analysis.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ do_cppcheck()
6969

7070
cppcheck_bin=$(command -v cppcheck || true)
7171
if [ -z "${cppcheck_bin}" ]; then
72-
echo "[!] cppcheck not installed. Failed to run static analysis the source code." >&2
72+
echo "[!] cppcheck not installed. Failed to run static analysis on the source code." >&2
7373
exit 1
7474
fi
7575

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ $ brew install mactex
4040
$ sudo tlmgr update --self
4141
```
4242

43-
Note that `latexmk` is required to generated PDF, and it probably has been installed on your OS already. If not, please follow the [installation guide](https://mg.readthedocs.io/latexmk.html#installation).
43+
Note that `latexmk` is required to generate PDF, and it probably has been installed on your OS already. If not, please follow the [installation guide](https://mg.readthedocs.io/latexmk.html#installation).
4444

45-
In macOS systems, package `Pygments` may not be pre-installed. If not, please refer to the [installation guide](https://pygments.org/download/) before generate documents.
45+
In macOS systems, package `Pygments` may not be pre-installed. If not, please refer to the [installation guide](https://pygments.org/download/) before generating documents.
4646

4747
Alternatively, using [Docker](https://docs.docker.com/) is recommended, as it guarantees the same dependencies with our GitHub Actions workflow.
48-
After install [docker engine](https://docs.docker.com/engine/install/) on your machine, pull the docker image [twtug/lkmpg](https://hub.docker.com/r/twtug/lkmpg) and run in isolated containers.
48+
After installing [docker engine](https://docs.docker.com/engine/install/) on your machine, pull the docker image [twtug/lkmpg](https://hub.docker.com/r/twtug/lkmpg) and run in isolated containers.
4949

5050
```shell
5151
# pull docker image and run it as container
@@ -70,4 +70,4 @@ $ make clean # Delete generated files
7070
The Linux Kernel Module Programming Guide is a free book; you may reproduce and/or modify it under the terms of the [Open Software License](https://opensource.org/licenses/OSL-3.0).
7171
Use of this work is governed by a copyleft license that can be found in the `LICENSE` file.
7272

73-
The complementary sample code is licensed under GNU GPL version 2, as same as Linux kernel.
73+
The complementary sample code is licensed under GNU GPL version 2, the same as the Linux kernel.

examples/bh_threaded.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* bh_thread.c - Top and bottom half interrupt handling
2+
* bh_threaded.c - Top and bottom half interrupt handling
33
*
44
* Based upon the RPi example by Stefan Wendler (devnull@kaltpost.de)
55
* from:

examples/chardev.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/* _IOW means that we are creating an ioctl command number for passing
2222
* information from a user process to the kernel module.
2323
*
24-
* The first arguments, MAJOR_NUM, is the major device number we are using.
24+
* The first argument, MAJOR_NUM, is the major device number we are using.
2525
*
2626
* The second argument is the number of the command (there could be several
2727
* with different meanings).

examples/other/userspace_ioctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

2-
/* userspace_ioctl.c - the process to use ioctl's to control the kernel module
2+
/* userspace_ioctl.c - the process to use ioctls to control the kernel module
33
*
44
* Until now we could have used cat for input and output. But now
5-
* we need to do ioctl's, which require writing our own process.
5+
* we need to do ioctls, which require writing our own process.
66
*/
77

88
/* device specifics, such as ioctl numbers and the

examples/procfs2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static ssize_t procfile_read(struct file *file_pointer, char __user *buffer,
4343
return ret;
4444
}
4545

46-
/* This function is called with the /proc file is written. */
46+
/* This function is called when the /proc file is written. */
4747
static ssize_t procfile_write(struct file *file, const char __user *buff,
4848
size_t len, loff_t *off)
4949
{

examples/procfs4.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static int my_seq_show(struct seq_file *s, void *v)
6161
return 0;
6262
}
6363

64-
/* This structure gather "function" to manage the sequence */
64+
/* This structure gathers functions to manage the sequence */
6565
static struct seq_operations my_seq_ops = {
6666
.start = my_seq_start,
6767
.next = my_seq_next,
@@ -75,7 +75,7 @@ static int my_open(struct inode *inode, struct file *file)
7575
return seq_open(file, &my_seq_ops);
7676
};
7777

78-
/* This structure gather "function" that manage the /proc file */
78+
/* This structure gathers functions that manage the /proc file */
7979
#ifdef HAVE_PROC_OPS
8080
static const struct proc_ops my_file_ops = {
8181
.proc_open = my_open,

lkmpg.tex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@ \subsection{The file\_operations Structure}
13411341

13421342
An instance of \cpp|struct file_operations| containing pointers to functions that are used to implement \cpp|read|, \cpp|write|, \cpp|open|, \ldots{} system calls is commonly named \cpp|fops|.
13431343

1344-
Since Linux v3.14, the read, write and seek operations are guaranteed for thread-safe by using the \cpp|f_pos| specific lock, which makes the file position update to become the mutual exclusion.
1344+
Since Linux v3.14, the read, write and seek operations are guaranteed to be thread-safe by using the \cpp|f_pos| specific lock, which makes the file position update to become the mutual exclusion.
13451345
So, we can safely implement those operations without unnecessary locking.
13461346

13471347
Additionally, since Linux v5.6, the \cpp|proc_ops| structure was introduced to replace the use of the \cpp|file_operations| structure when registering proc handlers.
@@ -1812,8 +1812,8 @@ \section{Talking To Device Files}
18121812
However, this leaves open the question of what to do when you need to talk to the serial port itself, for example to configure the rate at which data is sent and received.
18131813

18141814
The answer in Unix is to use a special function called \cpp|ioctl| (short for Input Output ConTroL).
1815-
Every device can have its own \cpp|ioctl| commands, which can be read ioctl's (to send information from a process to the kernel), write ioctl's (to return information to a process), both or neither.
1816-
Notice here the roles of read and write are reversed again, so in ioctl's read is to send information to the kernel and write is to receive information from the kernel.
1815+
Every device can have its own \cpp|ioctl| commands, which can be read ioctls (to send information from a process to the kernel), write ioctls (to return information to a process), both or neither.
1816+
Notice here the roles of read and write are reversed again, so in ioctls read is to send information to the kernel and write is to receive information from the kernel.
18171817

18181818
The ioctl function is called with three parameters: the file descriptor of the appropriate device file, the ioctl number, and a parameter, which is of type long so you can use a cast to use it to pass anything.
18191819
You will not be able to pass a structure this way, but you will be able to pass a pointer to the structure.
@@ -1825,7 +1825,7 @@ \section{Talking To Device Files}
18251825
It is the ioctl number.
18261826
The ioctl number encodes the major device number, the type of the ioctl, the command, and the type of the parameter.
18271827
This ioctl number is usually created by a macro call (\cpp|_IO|, \cpp|_IOR|, \cpp|_IOW| or \cpp|_IOWR| --- depending on the type) in a header file.
1828-
This header file should then be included both by the programs which will use ioctl (so they can generate the appropriate ioctl's) and by the kernel module (so it can understand it).
1828+
This header file should then be included both by the programs which will use ioctl (so they can generate the appropriate ioctls) and by the kernel module (so it can understand it).
18291829
In the example below, the header file is \verb|chardev.h| and the program which uses it is \verb|userspace_ioctl.c|.
18301830

18311831
If you want to use ioctls in your own kernel modules, it is best to receive an official ioctl assignment, so if you accidentally get somebody else's ioctls, or if they get yours, you'll know something is wrong.
@@ -2010,7 +2010,7 @@ \section{System Calls}
20102010
Without \verb|KASLR|, the attacker may find the target address in the fixed address easily.
20112011
Then the attacker can use return-oriented programming to insert some malicious codes to execute or receive the target data by a tampered pointer.
20122012
\verb|KASLR| mitigates these kinds of attacks because the attacker cannot immediately know the target address, but a brute-force attack can still work.
2013-
If the address of a symbol in \verb|/proc/kallsyms| is different from the address in \verb|/boot/System.map|, \verb|KASLR| is enabled with the kernel, which your system running on.
2013+
If the address of a symbol in \verb|/proc/kallsyms| is different from the address in \verb|/boot/System.map|, \verb|KASLR| is enabled with the kernel, on which your system is running.
20142014
\begin{verbatim}
20152015
$ grep GRUB_CMDLINE_LINUX_DEFAULT /etc/default/grub
20162016
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
@@ -2389,7 +2389,7 @@ \subsection{Flashing keyboard LEDs}
23892389
If none of the examples in this chapter fit your debugging needs, there might yet be some other tricks to try.
23902390
Ever wondered what \cpp|CONFIG_DEBUG_LL| in \sh|make menuconfig| is good for?
23912391
If you activate that you get low level access to the serial port.
2392-
While this might not sound very powerful by itself, you can patch \src{kernel/printk/printk.c} or any other essential kernel function to print ASCII characters, thus making it possible to trace virtually everything what your code does over a serial line.
2392+
While this might not sound very powerful by itself, you can patch \src{kernel/printk/printk.c} or any other essential kernel function to print ASCII characters, thus making it possible to trace virtually everything that your code does over a serial line.
23932393
If you find yourself porting the kernel to some new and former unsupported architecture, this is usually amongst the first things that should be implemented.
23942394
Logging over a netconsole might also be worth a try.
23952395

@@ -2889,7 +2889,7 @@ \subsection{Interrupt Handlers}
28892889
To take advantage of them requires handlers to be written in assembly language, so they do not really fit into the kernel.
28902890
They can be made to work similar to the others, but after that procedure, they are no longer any faster than "common" IRQs.
28912891
SMP enabled kernels running on systems with more than one processor need to solve another truckload of problems.
2892-
It is not enough to know if a certain IRQs has happened, it's also important to know what CPU(s) it was for.
2892+
It is not enough to know if a certain IRQ has happened, it's also important to know what CPU(s) it was for.
28932893
People still interested in more details, might want to refer to "APIC" now.
28942894

28952895
This function receives the IRQ number, the name of the function, flags, a name for \verb|/proc/interrupts| and a parameter to be passed to the interrupt handler.

scripts/Exclude

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Jim Huang, One of main author
1+
Jim Huang, One of the main authors

0 commit comments

Comments
 (0)