mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Kees Cook <keescook@chromium.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: [PATCH 4/4] kernel/, init/: avoid const-laundering warnings
Date: Wed, 22 Aug 2018 13:00:09 +0200	[thread overview]
Message-ID: <20180822110009.17583-4-linux@rasmusvillemoes.dk> (raw)
In-Reply-To: <20180822110009.17583-1-linux@rasmusvillemoes.dk>

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@rasmusvillemoes.dk>
---
 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


  parent reply	other threads:[~2018-08-22 11:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22 11:00 [PATCH 1/4] string: try to find const-laundering bugs Rasmus Villemoes
2018-08-22 11:00 ` [PATCH 2/4] drivers/base/devtmpfs.c: don't pretend path is const in delete_path Rasmus Villemoes
2018-08-22 11:00 ` [PATCH 3/4] lib/, include/: avoid const-laundering warnings Rasmus Villemoes
2018-08-22 11:00 ` Rasmus Villemoes [this message]
2018-08-22 11:07 ` [PATCH 1/4] string: try to find const-laundering bugs Joe Perches
2018-08-22 11:40   ` Rasmus Villemoes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180822110009.17583-4-linux@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=akpm@linux-foundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®