Skip to content

Commit 876979c

Browse files
Paul GortmakerJames Morris
authored andcommitted
security: audit and remove any unnecessary uses of module.h
Historically a lot of these existed because we did not have a distinction between what was modular code and what was providing support to modules via EXPORT_SYMBOL and friends. That changed when we forked out support for the latter into the export.h file. This means we should be able to reduce the usage of module.h in code that is obj-y Makefile or bool Kconfig. The advantage in removing such instances is that module.h itself sources about 15 other headers; adding significantly to what we feed cpp, and it can obscure what headers we are effectively using. Since module.h might have been the implicit source for init.h (for __init) and for export.h (for EXPORT_SYMBOL) we consider each instance for the presence of either and replace as needed. Cc: James Morris <jmorris@namei.org> Cc: "Serge E. Hallyn" <serge@hallyn.com> Cc: John Johansen <john.johansen@canonical.com> Cc: Mimi Zohar <zohar@linux.ibm.com> Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com> Cc: David Howells <dhowells@redhat.com> Cc: linux-security-module@vger.kernel.org Cc: linux-integrity@vger.kernel.org Cc: keyrings@vger.kernel.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: James Morris <james.morris@microsoft.com>
1 parent 3aafb1f commit 876979c

24 files changed

Lines changed: 14 additions & 24 deletions

‎security/apparmor/apparmorfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <linux/ctype.h>
1616
#include <linux/security.h>
1717
#include <linux/vmalloc.h>
18-
#include <linux/module.h>
18+
#include <linux/init.h>
1919
#include <linux/seq_file.h>
2020
#include <linux/uaccess.h>
2121
#include <linux/mount.h>

‎security/commoncap.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#include <linux/capability.h>
1111
#include <linux/audit.h>
12-
#include <linux/module.h>
1312
#include <linux/init.h>
1413
#include <linux/kernel.h>
1514
#include <linux/lsm_hooks.h>

‎security/integrity/evm/evm_crypto.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1717

18-
#include <linux/module.h>
18+
#include <linux/export.h>
1919
#include <linux/crypto.h>
2020
#include <linux/xattr.h>
2121
#include <linux/evm.h>

‎security/integrity/evm/evm_posix_acl.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* the Free Software Foundation, version 2 of the License.
1010
*/
1111

12-
#include <linux/module.h>
1312
#include <linux/xattr.h>
1413
#include <linux/evm.h>
1514

‎security/integrity/evm/evm_secfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#include <linux/audit.h>
1919
#include <linux/uaccess.h>
20-
#include <linux/module.h>
20+
#include <linux/init.h>
2121
#include <linux/mutex.h>
2222
#include "evm.h"
2323

‎security/integrity/iint.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* using a rbtree tree.
1717
*/
1818
#include <linux/slab.h>
19-
#include <linux/module.h>
19+
#include <linux/init.h>
2020
#include <linux/spinlock.h>
2121
#include <linux/rbtree.h>
2222
#include <linux/file.h>

‎security/integrity/ima/ima_api.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
* Implements must_appraise_or_measure, collect_measurement,
1313
* appraise_measurement, store_measurement and store_template.
1414
*/
15-
#include <linux/module.h>
1615
#include <linux/slab.h>
1716
#include <linux/file.h>
1817
#include <linux/fs.h>

‎security/integrity/ima/ima_appraise.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* it under the terms of the GNU General Public License as published by
99
* the Free Software Foundation, version 2 of the License.
1010
*/
11-
#include <linux/module.h>
11+
#include <linux/init.h>
1212
#include <linux/file.h>
1313
#include <linux/fs.h>
1414
#include <linux/xattr.h>

‎security/integrity/ima/ima_fs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#include <linux/fcntl.h>
2222
#include <linux/slab.h>
23-
#include <linux/module.h>
23+
#include <linux/init.h>
2424
#include <linux/seq_file.h>
2525
#include <linux/rculist.h>
2626
#include <linux/rcupdate.h>

‎security/integrity/ima/ima_init.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1919

20-
#include <linux/module.h>
20+
#include <linux/init.h>
2121
#include <linux/scatterlist.h>
2222
#include <linux/slab.h>
2323
#include <linux/err.h>

0 commit comments

Comments
 (0)