[PATCH] mm: ensure the uniformity of arguments passed to do_mmap(..)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Standardize the way of passing a value to @populate parameter of do_mmap(..)
as follow:

1. Caller must initialize the variable to 0, except it's clarified as
   the name of the variable, 'unused'.
2. do_mmap(..) doesn't take care of its initialization.

This patch has a couple of changes that:
- callers initialize the variable to 0.
- remove the line of initialization inside do_mmap(..)

Signed-off-by: Leesoo Ahn <lsahn@xxxxxxxxxx>
---
 mm/mmap.c  | 2 --
 mm/nommu.c | 2 --
 mm/util.c  | 2 +-
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index d32b7e701058..4aebb1440c35 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -289,8 +289,6 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
 	struct mm_struct *mm = current->mm;
 	int pkey = 0;
 
-	*populate = 0;
-
 	if (!len)
 		return -EINVAL;
 
diff --git a/mm/nommu.c b/mm/nommu.c
index 9cb6e99215e2..fa69cd8271af 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1016,8 +1016,6 @@ unsigned long do_mmap(struct file *file,
 	int ret;
 	VMA_ITERATOR(vmi, current->mm, 0);
 
-	*populate = 0;
-
 	/* decide whether we should attempt the mapping, and if so what sort of
 	 * mapping */
 	ret = validate_mmap_request(file, addr, len, prot, flags, pgoff,
diff --git a/mm/util.c b/mm/util.c
index c1c3b06ab4f9..728effcab217 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -570,7 +570,7 @@ unsigned long vm_mmap_pgoff(struct file *file, unsigned long addr,
 {
 	unsigned long ret;
 	struct mm_struct *mm = current->mm;
-	unsigned long populate;
+	unsigned long populate = 0;
 	LIST_HEAD(uf);
 
 	ret = security_mmap_file(file, prot, flag);
-- 
2.46.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux