From nobody Tue Jun 9 01:05:33 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 203A5175A86; Mon, 25 May 2026 00:19:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779668350; cv=none; b=nfusztLMRIsj1TgJ7kXRc6P/1krFdBE9R/wDqmd7/YWwivx0F32rf2+56SGpnjzD14wfcSERXaMxyatQ83sPHwIiHUkZHP5flTXPNTzk4y74FR8VKPILcRsTM+myatUAvwJ68KSd6J7YGCszsfbOCr2dsac8RTIf+Xg7O2cWQG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779668350; c=relaxed/simple; bh=jAi0KxH+KlfrpowIw8FZG+dqFx1ET4tCeEMp/lAKXeo=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=fVH70OwcKJbKFkUUCxw5uaoN4+JJ6E9VPDmRgH9t1f1U0E1tSQknH1ZfQ8g78ZoyfOwy7mIOvC5f7kRSp2xvrr+6pQYq3/CVW89vOPp11YwxN2XmGQYCpxapptbOFGmJbDzuwVeaz58XZTbg+05bzBHlXu+3z2B/jl3aku2qq2I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=V0GCP/wb; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ROg+6MFt; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="V0GCP/wb"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ROg+6MFt" Date: Mon, 25 May 2026 00:18:59 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1779668341; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yrLuACV60jE/T0WP20u2W2OZwQgWV6B/otKZLANyYio=; b=V0GCP/wbSyNrpP35SVI9xZX2gGY+ps9exeHTRId+lmXlJ0BkyeQKWAJs/TBEr0FsXBGqYT m32/Ex07sePLXHFN3EqkjvPYNZRMVklPwXZCUUDQPZCXX7Xh1M0HRAhPFZtJWQ/IHx10iK YGdj3ENRwCcBlT/vkWQhPqdxpB1Tz7Fm288hVyUlv+3Vv/GKhYI7Qm+pNiRlSazSgYJRSM xL4adBD94NYp+5ZbQjhu7mIEIjJb2RVGazJup+x8iKUcxbZvi8sfHULdh2wHzKB2O16fOG ZizJ4ckuzKE5yRHUEvSv8iNwkxk9m8MqkCKH+YUfZ0n7Z3vZsG9CjwOrRXYTSw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1779668341; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yrLuACV60jE/T0WP20u2W2OZwQgWV6B/otKZLANyYio=; b=ROg+6MFteysTNuteo8KwJTj0iI9HIkOw9ZrBsWkMX3rOPeg2RoyIsdnmckYJKtekzu2EIp MbwTIL7q6f91wWBA== From: "tip-bot2 for Fushuai Wang" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cleanups] x86/tlb: Convert copy_from_user() + kstrtouint() to kstrtouint_from_user() Cc: Yury Norov , Fushuai Wang , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260117145615.53455-3-fushuai.wang@linux.dev> References: <20260117145615.53455-3-fushuai.wang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177966833929.1039918.5465056266198573652.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/cleanups branch of tip: Commit-ID: 648fb97ee908b602f507e8b1f1ae98dd6342f05d Gitweb: https://git.kernel.org/tip/648fb97ee908b602f507e8b1f1ae98dd6= 342f05d Author: Fushuai Wang AuthorDate: Sat, 17 Jan 2026 22:56:15 +08:00 Committer: Borislav Petkov (AMD) CommitterDate: Sun, 24 May 2026 16:08:38 -07:00 x86/tlb: Convert copy_from_user() + kstrtouint() to kstrtouint_from_user() Using kstrtouint_from_user() instead of copy_from_user() + kstrtouint() mak= es the code simpler and less error-prone. No functional changes. [ bp: Align function args on opening brace, while at it. ] Suggested-by: Yury Norov Signed-off-by: Fushuai Wang Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Yury Norov Link: https://patch.msgid.link/20260117145615.53455-3-fushuai.wang@linux.dev --- arch/x86/mm/tlb.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index af43d17..ce2e2c4 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -1769,7 +1769,7 @@ bool nmi_uaccess_okay(void) } =20 static ssize_t tlbflush_read_file(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) + size_t count, loff_t *ppos) { char buf[32]; unsigned int len; @@ -1778,20 +1778,15 @@ static ssize_t tlbflush_read_file(struct file *file= , char __user *user_buf, return simple_read_from_buffer(user_buf, count, ppos, buf, len); } =20 -static ssize_t tlbflush_write_file(struct file *file, - const char __user *user_buf, size_t count, loff_t *ppos) +static ssize_t tlbflush_write_file(struct file *file, const char __user *u= ser_buf, + size_t count, loff_t *ppos) { - char buf[32]; - ssize_t len; int ceiling; + int err; =20 - len =3D min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] =3D '\0'; - if (kstrtoint(buf, 0, &ceiling)) - return -EINVAL; + err =3D kstrtoint_from_user(user_buf, count, 0, &ceiling); + if (err) + return err; =20 if (ceiling < 0) return -EINVAL;