linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: constify nmask argument to mbind()
@ 2014-04-30 14:29 Rasmus Villemoes
  2014-04-30 14:44 ` Rik van Riel
  2014-04-30 20:00 ` [PATCH] mm: constify nmask argument to set_mempolicy() Rasmus Villemoes
  0 siblings, 2 replies; 3+ messages in thread
From: Rasmus Villemoes @ 2014-04-30 14:29 UTC (permalink / raw)
  To: linux-mm
  Cc: Andrew Morton, Mel Gorman, Rik van Riel, Peter Zijlstra,
	Ingo Molnar, David Rientjes, Naoya Horiguchi, Jianguo Wu,
	Rasmus Villemoes

The nmask argument to mbind() is const according to the user-space
header numaif.h, and since the kernel does indeed not modify it, it
might as well be declared const in the kernel.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 include/linux/syscalls.h | 2 +-
 mm/mempolicy.c           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index a4a0588..bfef0be 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -723,7 +723,7 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
 				int flags);
 asmlinkage long sys_mbind(unsigned long start, unsigned long len,
 				unsigned long mode,
-				unsigned long __user *nmask,
+				const unsigned long __user *nmask,
 				unsigned long maxnode,
 				unsigned flags);
 asmlinkage long sys_get_mempolicy(int __user *policy,
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 78e1472..727187f 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1362,7 +1362,7 @@ static int copy_nodes_to_user(unsigned long __user *mask, unsigned long maxnode,
 }
 
 SYSCALL_DEFINE6(mbind, unsigned long, start, unsigned long, len,
-		unsigned long, mode, unsigned long __user *, nmask,
+		unsigned long, mode, const unsigned long __user *, nmask,
 		unsigned long, maxnode, unsigned, flags)
 {
 	nodemask_t nodes;
-- 
2.0.0.rc1.4.gd8779e1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm: constify nmask argument to mbind()
  2014-04-30 14:29 [PATCH] mm: constify nmask argument to mbind() Rasmus Villemoes
@ 2014-04-30 14:44 ` Rik van Riel
  2014-04-30 20:00 ` [PATCH] mm: constify nmask argument to set_mempolicy() Rasmus Villemoes
  1 sibling, 0 replies; 3+ messages in thread
From: Rik van Riel @ 2014-04-30 14:44 UTC (permalink / raw)
  To: Rasmus Villemoes, linux-mm
  Cc: Andrew Morton, Mel Gorman, Peter Zijlstra, Ingo Molnar,
	David Rientjes, Naoya Horiguchi, Jianguo Wu

On 04/30/2014 10:29 AM, Rasmus Villemoes wrote:
> The nmask argument to mbind() is const according to the user-space
> header numaif.h, and since the kernel does indeed not modify it, it
> might as well be declared const in the kernel.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>

Acked-by: Rik van Riel <riel@redhat.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] mm: constify nmask argument to set_mempolicy()
  2014-04-30 14:29 [PATCH] mm: constify nmask argument to mbind() Rasmus Villemoes
  2014-04-30 14:44 ` Rik van Riel
@ 2014-04-30 20:00 ` Rasmus Villemoes
  1 sibling, 0 replies; 3+ messages in thread
From: Rasmus Villemoes @ 2014-04-30 20:00 UTC (permalink / raw)
  To: linux-mm; +Cc: Andrew Morton, Rik van Riel, Rasmus Villemoes

The nmask argument to set_mempolicy() is const according to the
user-space header numaif.h, and since the kernel does indeed not
modify it, it might as well be declared const in the kernel.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 include/linux/syscalls.h | 2 +-
 mm/mempolicy.c           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index bfef0be..b0881a0 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -711,7 +711,7 @@ asmlinkage long sys_keyctl(int cmd, unsigned long arg2, unsigned long arg3,
 
 asmlinkage long sys_ioprio_set(int which, int who, int ioprio);
 asmlinkage long sys_ioprio_get(int which, int who);
-asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask,
+asmlinkage long sys_set_mempolicy(int mode, const unsigned long __user *nmask,
 				unsigned long maxnode);
 asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
 				const unsigned long __user *from,
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 727187f..b09586d 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1383,7 +1383,7 @@ SYSCALL_DEFINE6(mbind, unsigned long, start, unsigned long, len,
 }
 
 /* Set the process memory policy */
-SYSCALL_DEFINE3(set_mempolicy, int, mode, unsigned long __user *, nmask,
+SYSCALL_DEFINE3(set_mempolicy, int, mode, const unsigned long __user *, nmask,
 		unsigned long, maxnode)
 {
 	int err;
-- 
1.9.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-30 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-30 14:29 [PATCH] mm: constify nmask argument to mbind() Rasmus Villemoes
2014-04-30 14:44 ` Rik van Riel
2014-04-30 20:00 ` [PATCH] mm: constify nmask argument to set_mempolicy() Rasmus Villemoes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).