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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260112073039.1185-3-fushuai.wang@linux.dev>
Date: Mon, 12 Jan 2026 15:30:35 +0800
From: Fushuai Wang <fushuai.wang@...ux.dev>
To: tglx@...nel.org,
	peterz@...radead.org,
	mathieu.desnoyers@...icios.com,
	akpm@...ux-foundation.org,
	aliceryhl@...gle.com,
	yury.norov@...il.com,
	vmalik@...hat.com,
	kees@...nel.org,
	dave.hansen@...ux.intel.com,
	luto@...nel.org,
	mingo@...hat.com,
	bp@...en8.de,
	hpa@...or.com,
	rostedt@...dmis.org,
	mhiramat@...nel.org,
	brauner@...nel.org,
	jack@...e.cz,
	cyphar@...har.com
Cc: linux-kernel@...r.kernel.org,
	x86@...nel.org,
	linux-trace-kernel@...r.kernel.org,
	wangfushuai@...du.com
Subject: [PATCH v2 2/6] x86/tlb: Use copy_from_user_nul() instead of copy_from_user()

From: Fushuai Wang <wangfushuai@...du.com>

Use copy_from_user_nul() instead of copy_from_user() to simplify
the code.

No functional change.

Signed-off-by: Fushuai Wang <wangfushuai@...du.com>
---
 arch/x86/mm/tlb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index f5b93e01e347..ae81e5cb510e 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -1807,10 +1807,9 @@ static ssize_t tlbflush_write_file(struct file *file,
 	int ceiling;
 
 	len = min(count, sizeof(buf) - 1);
-	if (copy_from_user(buf, user_buf, len))
+	if (copy_from_user_nul(buf, user_buf, len))
 		return -EFAULT;
 
-	buf[len] = '\0';
 	if (kstrtoint(buf, 0, &ceiling))
 		return -EINVAL;
 
-- 
2.36.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ