[PATCH 4/4] kernel/, init/: avoid const-laundering warnings

From: Rasmus Villemoes
Date: Wed Aug 22 2018 - 07:00:28 EST


Even though str*() launders the const away for us, we should and do not
modify the buffer through the returned pointer, so might as well declare
it const.

Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
---
init/do_mounts.c | 2 +-
kernel/module.c | 2 +-
kernel/params.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 2c71dabe5626..6eea8bfc8f82 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -122,7 +122,7 @@ static dev_t devt_from_partuuid(const char *uuid_str)
struct hd_struct *part;
int offset = 0;
bool clear_root_wait = false;
- char *slash;
+ const char *slash;

cmp.uuid = uuid_str;

diff --git a/kernel/module.c b/kernel/module.c
index b046a32520d8..8d7ead11a10f 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -4061,7 +4061,7 @@ static unsigned long mod_find_symname(struct module *mod, const char *name)
unsigned long module_kallsyms_lookup_name(const char *name)
{
struct module *mod;
- char *colon;
+ const char *colon;
unsigned long ret = 0;

/* Don't lock: we're in enough trouble already. */
diff --git a/kernel/params.c b/kernel/params.c
index ce89f757e6da..8744aa1e7d8f 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -816,7 +816,7 @@ static void __init param_sysfs_builtin(void)
char modname[MODULE_NAME_LEN];

for (kp = __start___param; kp < __stop___param; kp++) {
- char *dot;
+ const char *dot;

if (kp->perm == 0)
continue;
--
2.16.4