The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: "haoyu.lu" <hechushiguitu666@gmail.com>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>,
	 Vignesh Raghavendra <vigneshr@ti.com>,
	 chengzhihao1 <chengzhihao1@huawei.com>,
	 linux-mtd <linux-mtd@lists.infradead.org>,
	 linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] ubi: build: replace simple_strtoul with kstrtoul in bytes_str_to_int()
Date: Thu, 7 May 2026 09:30:56 +0200 (CEST)	[thread overview]
Message-ID: <713519488.1541.1778139056408.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <20260507032308.16485-2-hechushiguitu666@gmail.com>

----- Ursprüngliche Mail -----
> Von: "haoyu.lu" <hechushiguitu666@gmail.com>
> An: "Miquel Raynal" <miquel.raynal@bootlin.com>, "richard" <richard@nod.at>, "Vignesh Raghavendra" <vigneshr@ti.com>
> CC: "chengzhihao1" <chengzhihao1@huawei.com>, "linux-mtd" <linux-mtd@lists.infradead.org>, "linux-kernel"
> <linux-kernel@vger.kernel.org>, "Haoyu Lu" <hechushiguitu666@gmail.com>
> Gesendet: Donnerstag, 7. Mai 2026 05:23:08
> Betreff: [PATCH 2/2] ubi: build: replace simple_strtoul with kstrtoul in bytes_str_to_int()

> From: Haoyu Lu <hechushiguitu666@gmail.com>
> 
> Replace the deprecated simple_strtoul() with kstrtoul() in the
>
> bytes_str_to_int() helper function. Since kstrtoul() rejects trailing
> non-numeric characters (such as the G/M/K suffixes), the numeric prefix
> is first extracted with strspn() and then parsed separately before
> handling the suffix.
> 
> This provides proper error handling through the kstrto* family while
> preserving the existing suffix semantics for byte count parameters.
> 
> Note: the original simple_strtoul() with base=0 accepted hexadecimal
> (0x prefix) and octal (0 prefix) formats, while kstrtoul() with base=10
> only supports decimal. This is not a practical concern since MTD byte
> count parameters are always specified as decimal values in boot
> parameters.
> 
> Signed-off-by: Haoyu Lu <hechushiguitu666@gmail.com>
> ---
> drivers/mtd/ubi/build.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)


Your patch does not explain why this change is needed.
From what I can tell, it just makes the existing code more complex and
fixes no real issues.

Is simple_strtoul() really deprecated? If so, where?
AFAICT, the documentation just mentions:
"This function has caveats. Please use kstrtol instead."

Do these these caveats hurt the current code?

Thanks,
//richard

  reply	other threads:[~2026-05-07  7:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07  3:23 [PATCH 1/2] ubi: build: replace simple_strtoul with kstrtouint in open_mtd_device() haoyu.lu
2026-05-07  3:23 ` [PATCH 2/2] ubi: build: replace simple_strtoul with kstrtoul in bytes_str_to_int() haoyu.lu
2026-05-07  7:30   ` Richard Weinberger [this message]
2026-05-07  7:45   ` Zhihao Cheng
2026-05-07  7:50     ` Richard Weinberger
2026-05-07  8:25       ` Haoyu Lu
2026-05-07  7:40 ` [PATCH 1/2] ubi: build: replace simple_strtoul with kstrtouint in open_mtd_device() Zhihao Cheng

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=713519488.1541.1778139056408.JavaMail.zimbra@nod.at \
    --to=richard@nod.at \
    --cc=chengzhihao1@huawei.com \
    --cc=hechushiguitu666@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=vigneshr@ti.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