Skip to contentSkip to conversation

module: make the modinfo name const

PATCH Applied Luis R. Rodriguez 3 participants 3 messages Jun 29, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 module: make the modinfo name const

This can be accomplished by makine blacklisted() also accept const.

---
 kernel/module.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/module.c +2 -2
index 5ebe3ae2519a..7d679f3bb892 100644
@@ -302,7 +302,7 @@ int unregister_module_notifier(struct notifier_block *nb)
 EXPORT_SYMBOL(unregister_module_notifier);
 
 struct load_info {
-	char *name;
+	const char *name;
 	Elf_Ehdr *hdr;
 	unsigned long len;
 	Elf_Shdr *sechdrs;
@@ -3382,7 +3382,7 @@ int __weak module_frob_arch_sections(Elf_Ehdr *hdr,
 
 /* module_blacklist is a comma-separated list of module names */
 static char *module_blacklist;
-static bool blacklisted(char *module_name)
+static bool blacklisted(const char *module_name)
 {
 	const char *p;
 	size_t len;
Signature · 1 line
2.10.2
Acked-by on v1 1/1
#1 lore raw
Quoted 1 line · Luis R. Rodriguez

This can be accomplished by makine blacklisted() also accept const.

Typo "making"

Quoted 1 line

But otherwise:

-Kees

Quoted 29 lines
---
 kernel/module.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/module.c +2 -3
index 5ebe3ae2519a..7d679f3bb892 100644
@@ -302,7 +302,7 @@ int unregister_module_notifier(struct notifier_block *nb)
 EXPORT_SYMBOL(unregister_module_notifier);
 
 struct load_info {
-       char *name;
+       const char *name;
        Elf_Ehdr *hdr;
        unsigned long len;
        Elf_Shdr *sechdrs;
@@ -3382,7 +3382,7 @@ int __weak module_frob_arch_sections(Elf_Ehdr *hdr,
 
 /* module_blacklist is a comma-separated list of module names */
 static char *module_blacklist;
-static bool blacklisted(char *module_name)
+static bool blacklisted(const char *module_name)
 {
        const char *p;
        size_t len;
--

2.10.2

Signature · 2 lines
Kees Cook
Pixel Security
Applied
#2 lore raw
In reply to Luis R. Rodriguez

+++ Luis R. Rodriguez [28/06/17 18:32 -0700]:

Quoted 3 lines

This can be accomplished by makine blacklisted() also accept const.

Applied, thanks!

Quoted 29 lines

---
kernel/module.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
kernel/module.c +2 -2
index 5ebe3ae2519a..7d679f3bb892 100644
@@ -302,7 +302,7 @@ int unregister_module_notifier(struct notifier_block *nb)
 EXPORT_SYMBOL(unregister_module_notifier);
 
 struct load_info {
-	char *name;
+	const char *name;
 	Elf_Ehdr *hdr;
 	unsigned long len;
 	Elf_Shdr *sechdrs;
@@ -3382,7 +3382,7 @@ int __weak module_frob_arch_sections(Elf_Ehdr *hdr,
 
 /* module_blacklist is a comma-separated list of module names */
 static char *module_blacklist;
-static bool blacklisted(char *module_name)
+static bool blacklisted(const char *module_name)
 {
 	const char *p;
 	size_t len;
Signature · 1 line
2.10.2