summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>2015-08-28 14:10:13 +0300
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>2015-08-28 14:36:27 +0300
commita2e5cc4edd58c153368ff610acd810f3e99949c6 (patch)
tree1fb5e557776537e820683c07eb34b13645342d02
parent195a72abdfa1fb6923df7c6fc342808c52fd0bab (diff)
downloadswap-modules-a2e5cc4edd58c153368ff610acd810f3e99949c6.tar.gz
swap-modules-a2e5cc4edd58c153368ff610acd810f3e99949c6.tar.bz2
swap-modules-a2e5cc4edd58c153368ff610acd810f3e99949c6.zip
[FIX] mmap allocation atribute
PROT_WRITE atribute is needed for writing into allocated memory Change-Id: I6beb96bae7c331024b99fb2675bcde4430e1f9f0 Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
-rw-r--r--preload/preload_pd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/preload/preload_pd.c b/preload/preload_pd.c
index 568b310e..ec7a7eca 100644
--- a/preload/preload_pd.c
+++ b/preload/preload_pd.c
@@ -290,7 +290,7 @@ static unsigned long make_preload_path(void)
size_t len = strnlen(path, PATH_MAX);
down_write(&current->mm->mmap_sem);
- page = swap_do_mmap(NULL, 0, PAGE_SIZE, PROT_READ,
+ page = swap_do_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, 0);
up_write(&current->mm->mmap_sem);
@@ -301,7 +301,7 @@ static unsigned long make_preload_path(void)
}
/* set preload_library path */
- if (copy_to_user((void __user *)page, path, len) <= 0)
+ if (copy_to_user((void __user *)page, path, len) != 0)
printk(KERN_ERR PRELOAD_PREFIX
"Cannot copy string to user!\n");
}