All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emese Revfy <re.emese@gmail.com>
To: kernel-hardening@lists.openwall.com
Cc: pageexec@freemail.hu, spender@grsecurity.net, mmarek@suse.com,
	keescook@chromium.org, linux-kernel@vger.kernel.org,
	yamada.masahiro@socionext.com, linux-kbuild@vger.kernel.org,
	minipli@ld-linux.so, linux@armlinux.org.uk,
	catalin.marinas@arm.com, linux@rasmusvillemoes.dk,
	david.brown@linaro.org, benh@kernel.crashing.org,
	tglx@linutronix.de, akpm@linux-foundation.org,
	jlayton@poochiereds.net, arnd@arndb.de, sam@ravnborg.org,
	isdn@linux-pingi.de
Subject: [PATCH v3 1/7] Move type casts into is_kernel_rodata
Date: Tue, 26 Jul 2016 22:36:40 +0200	[thread overview]
Message-ID: <20160726223640.fe5ae5cff05ff12faf26ff44@gmail.com> (raw)
In-Reply-To: <20160726223541.513ce76f6de65389da6a6abe@gmail.com>

so that its parameter can be marked as nocapture.

Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 mm/util.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/util.c b/mm/util.c
index 662cddf..d95f10b 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -17,10 +17,10 @@
 
 #include "internal.h"
 
-static inline int is_kernel_rodata(unsigned long addr)
+static inline int is_kernel_rodata(const void *addr)
 {
-	return addr >= (unsigned long)__start_rodata &&
-		addr < (unsigned long)__end_rodata;
+	return (unsigned long)addr >= (unsigned long)__start_rodata &&
+		(unsigned long)addr < (unsigned long)__end_rodata;
 }
 
 /**
@@ -31,7 +31,7 @@ static inline int is_kernel_rodata(unsigned long addr)
  */
 void kfree_const(const void *x)
 {
-	if (!is_kernel_rodata((unsigned long)x))
+	if (!is_kernel_rodata(x))
 		kfree(x);
 }
 EXPORT_SYMBOL(kfree_const);
@@ -68,7 +68,7 @@ EXPORT_SYMBOL(kstrdup);
  */
 const char *kstrdup_const(const char *s, gfp_t gfp)
 {
-	if (is_kernel_rodata((unsigned long)s))
+	if (is_kernel_rodata(s))
 		return s;
 
 	return kstrdup(s, gfp);
-- 
2.8.1

WARNING: multiple messages have this Message-ID (diff)
From: Emese Revfy <re.emese@gmail.com>
To: kernel-hardening@lists.openwall.com
Cc: pageexec@freemail.hu, spender@grsecurity.net, mmarek@suse.com,
	keescook@chromium.org, linux-kernel@vger.kernel.org,
	yamada.masahiro@socionext.com, linux-kbuild@vger.kernel.org,
	minipli@ld-linux.so, linux@armlinux.org.uk,
	catalin.marinas@arm.com, linux@rasmusvillemoes.dk,
	david.brown@linaro.org, benh@kernel.crashing.org,
	tglx@linutronix.de, akpm@linux-foundation.org,
	jlayton@poochiereds.net, arnd@arndb.de, sam@ravnborg.org,
	isdn@linux-pingi.de
Subject: [kernel-hardening] [PATCH v3 1/7] Move type casts into is_kernel_rodata
Date: Tue, 26 Jul 2016 22:36:40 +0200	[thread overview]
Message-ID: <20160726223640.fe5ae5cff05ff12faf26ff44@gmail.com> (raw)
In-Reply-To: <20160726223541.513ce76f6de65389da6a6abe@gmail.com>

so that its parameter can be marked as nocapture.

Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 mm/util.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/util.c b/mm/util.c
index 662cddf..d95f10b 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -17,10 +17,10 @@
 
 #include "internal.h"
 
-static inline int is_kernel_rodata(unsigned long addr)
+static inline int is_kernel_rodata(const void *addr)
 {
-	return addr >= (unsigned long)__start_rodata &&
-		addr < (unsigned long)__end_rodata;
+	return (unsigned long)addr >= (unsigned long)__start_rodata &&
+		(unsigned long)addr < (unsigned long)__end_rodata;
 }
 
 /**
@@ -31,7 +31,7 @@ static inline int is_kernel_rodata(unsigned long addr)
  */
 void kfree_const(const void *x)
 {
-	if (!is_kernel_rodata((unsigned long)x))
+	if (!is_kernel_rodata(x))
 		kfree(x);
 }
 EXPORT_SYMBOL(kfree_const);
@@ -68,7 +68,7 @@ EXPORT_SYMBOL(kstrdup);
  */
 const char *kstrdup_const(const char *s, gfp_t gfp)
 {
-	if (is_kernel_rodata((unsigned long)s))
+	if (is_kernel_rodata(s))
 		return s;
 
 	return kstrdup(s, gfp);
-- 
2.8.1

  reply	other threads:[~2016-07-26 20:18 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-26 20:35 [PATCH v3 0/7] Introduce the initify gcc plugin Emese Revfy
2016-07-26 20:35 ` [kernel-hardening] " Emese Revfy
2016-07-26 20:36 ` Emese Revfy [this message]
2016-07-26 20:36   ` [kernel-hardening] [PATCH v3 1/7] Move type casts into is_kernel_rodata Emese Revfy
2016-07-26 20:38 ` [PATCH v3 2/7] Split up struct warn_args Emese Revfy
2016-07-26 20:38   ` [kernel-hardening] " Emese Revfy
2016-07-27  1:15   ` kbuild test robot
2016-07-27  1:15     ` [kernel-hardening] " kbuild test robot
2016-07-27  2:27   ` kbuild test robot
2016-07-27  2:27     ` [kernel-hardening] " kbuild test robot
2016-07-27 15:31   ` Emese Revfy
2016-07-27 15:31     ` [kernel-hardening] " Emese Revfy
2016-07-26 20:39 ` [PATCH v3 3/7] Constify some function parameters Emese Revfy
2016-07-26 20:39   ` [kernel-hardening] " Emese Revfy
2016-07-26 20:40 ` [PATCH v3 4/7] Add the initify gcc plugin Emese Revfy
2016-07-26 20:40   ` [kernel-hardening] " Emese Revfy
2016-07-26 20:41 ` [PATCH v3 5/7] Mark functions with the __nocapture attribute Emese Revfy
2016-07-26 20:41   ` [kernel-hardening] " Emese Revfy
2016-07-26 20:42 ` [PATCH v3 6/7] Mark a few functions with the printf attribute Emese Revfy
2016-07-26 20:42   ` [kernel-hardening] " Emese Revfy
2016-07-27  1:17   ` kbuild test robot
2016-07-27  1:17     ` [kernel-hardening] " kbuild test robot
2016-07-27  1:23   ` kbuild test robot
2016-07-27  1:23     ` [kernel-hardening] " kbuild test robot
2016-07-27  1:29   ` kbuild test robot
2016-07-27  1:29     ` [kernel-hardening] " kbuild test robot
2016-07-27 15:34   ` Emese Revfy
2016-07-27 15:34     ` [kernel-hardening] " Emese Revfy
2016-07-26 20:43 ` [PATCH v3 7/7] Mark functions with the __unverified_nocapture attribute Emese Revfy
2016-07-26 20:43   ` [kernel-hardening] " Emese Revfy

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=20160726223640.fe5ae5cff05ff12faf26ff44@gmail.com \
    --to=re.emese@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=catalin.marinas@arm.com \
    --cc=david.brown@linaro.org \
    --cc=isdn@linux-pingi.de \
    --cc=jlayton@poochiereds.net \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@rasmusvillemoes.dk \
    --cc=minipli@ld-linux.so \
    --cc=mmarek@suse.com \
    --cc=pageexec@freemail.hu \
    --cc=sam@ravnborg.org \
    --cc=spender@grsecurity.net \
    --cc=tglx@linutronix.de \
    --cc=yamada.masahiro@socionext.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.