Skip to contentSkip to conversation

prctl: prctl_set_mm -- Move PR_SET_MM_MAP_SIZE out of prctl_set_mm_map

RFC New Cyrill Gorcunov 1 participant 1 message May 7, 2018 Memory management

lore
Share & tools
lore
#0 lore raw

RFC 1/3 prctl: prctl_set_mm -- Move PR_SET_MM_MAP_SIZE out of prctl_set_mm_map

It is a preparatory patch so next we will make prctl_set_mm_map to accept struct prctl_mm_map as an argument and the only thing prctl_set_mm_map will do is to setup new memory map, not handling any other operations.

CC Jonathan de Boyne Pollard <[email protected]>
CC Andrey Vagin <[email protected]>
CC Andrew Morton <[email protected]>
CC Michael Kerrisk <[email protected]>
CC Yang Shi <[email protected]>
CC Michal Hocko <[email protected]>
---
 kernel/sys.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/sys.c +5 -5
Index: linux-ml.git/kernel/sys.c
===================================================================
@@ -1979,10 +1979,6 @@ static int prctl_set_mm_map(int opt, con
 	BUILD_BUG_ON(sizeof(user_auxv) != sizeof(mm->saved_auxv));
 	BUILD_BUG_ON(sizeof(struct prctl_mm_map) > 256);
 
-	if (opt == PR_SET_MM_MAP_SIZE)
-		return put_user((unsigned int)sizeof(prctl_map),
-				(unsigned int __user *)addr);
-
 	if (data_size != sizeof(prctl_map))
 		return -EINVAL;
 
@@ -2063,7 +2059,11 @@ static int prctl_set_mm(int opt, unsigne
 			unsigned long arg4, unsigned long arg5)
 {
 #ifdef CONFIG_CHECKPOINT_RESTORE
-	if (opt == PR_SET_MM_MAP || opt == PR_SET_MM_MAP_SIZE)
+	if (opt == PR_SET_MM_MAP_SIZE)
+		return put_user((unsigned int)sizeof(struct prctl_mm_map),
+				(unsigned int __user *)addr);
+
+	if (opt == PR_SET_MM_MAP)
 		return prctl_set_mm_map(opt, (const void __user *)addr, arg4);
 #endif