Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20160726223640.fe5ae5cff05ff12faf26ff44@gmail.com>
Date: Tue, 26 Jul 2016 22:36:40 +0200
From: Emese Revfy <re.emese@...il.com>
To: kernel-hardening@...ts.openwall.com
Cc: pageexec@...email.hu, spender@...ecurity.net, mmarek@...e.com,
 keescook@...omium.org, linux-kernel@...r.kernel.org,
 yamada.masahiro@...ionext.com, linux-kbuild@...r.kernel.org,
 minipli@...linux.so, linux@...linux.org.uk, catalin.marinas@....com,
 linux@...musvillemoes.dk, david.brown@...aro.org, benh@...nel.crashing.org,
 tglx@...utronix.de, akpm@...ux-foundation.org, jlayton@...chiereds.net,
 arnd@...db.de, sam@...nborg.org, isdn@...ux-pingi.de
Subject: [PATCH v3 1/7] Move type casts into is_kernel_rodata

so that its parameter can be marked as nocapture.

Signed-off-by: Emese Revfy <re.emese@...il.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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.