lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250104063925.1544944-1-lsahn@ooseel.net>
Date: Sat,  4 Jan 2025 15:39:25 +0900
From: Leesoo Ahn <lsahn@...eel.net>
To: lsahn@...eel.net
Cc: Andrew Morton <akpm@...ux-foundation.org>,
	"Liam R. Howlett" <Liam.Howlett@...cle.com>,
	Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
	Vlastimil Babka <vbabka@...e.cz>,
	Jann Horn <jannh@...gle.com>,
	linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] mm: ensure the uniformity of arguments passed to do_mmap(..)

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@...eel.net>
---
 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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ