mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fushuai Wang <fushuai.wang@linux.dev>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.com, dave.hansen@linux.intel.com,
	luto@kernel.org, tglx@kernel.org, bp@alien8.de, hpa@zytor.com
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	wangfushuai@baidu.com, aliceryhl@google.com, ynorov@nvidia.com
Subject: [PATCH 0/2] Convert copy_from_user() + kstrtouint() to kstrtouint_from_user()
Date: Fri, 16 Jan 2026 21:17:49 +0800	[thread overview]
Message-ID: <20260116131751.45768-1-fushuai.wang@linux.dev> (raw)

From: Fushuai Wang <wangfushuai@baidu.com>

Hi,

There are several places use copy_from_user() to copy a string from
userspase, followed by kstrtoXXX() to convert it to a desired type.
This approach requires manually handling NUL-termination and proper
buffer sizing, which is error-prone and unnecessarily complex. The
kernel provides kstrtoXXX_from_user() helpers to copy a string from
userspace and perform the conversion in one step. So use a
kstrtoXXX_from_user() instead of copy_from_user() + kstrtoXXX().

Recent discussion:
https://lore.kernel.org/all/20260112073039.1185-1-fushuai.wang@linux.dev/T/

Fushuai Wang (2):
  sched/debug: Convert copy_from_user() + kstrtouint() to
    kstrtouint_from_user()
  x86/tlb: Convert copy_from_user() + kstrtouint() to
    kstrtouint_from_user()

 arch/x86/mm/tlb.c    | 13 ++++---------
 kernel/sched/debug.c | 14 ++++----------
 2 files changed, 8 insertions(+), 19 deletions(-)

-- 
2.36.1


             reply	other threads:[~2026-01-16 13:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-16 13:17 Fushuai Wang [this message]
2026-01-16 13:17 ` [PATCH 1/2] sched/debug: " Fushuai Wang
2026-01-16 17:04   ` Yury Norov
2026-01-16 13:17 ` [PATCH 2/2] x86/tlb: " Fushuai Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260116131751.45768-1-fushuai.wang@linux.dev \
    --to=fushuai.wang@linux.dev \
    --cc=aliceryhl@google.com \
    --cc=bp@alien8.de \
    --cc=bsegall@google.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=hpa@zytor.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=wangfushuai@baidu.com \
    --cc=x86@kernel.org \
    --cc=ynorov@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®