* [PATCH v2 0/3] spi: use kstrtoul() and snprintf()
@ 2026-10-10 8:35 Aayush Kumar
2026-10-10 8:35 ` [PATCH v2 1/3] spi: tle62x0: Use kstrtoul() instead of simple_strtoul() Aayush Kumar
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Aayush Kumar @ 2026-10-10 8:35 UTC (permalink / raw)
To: Mark Brown; +Cc: David Laight, linux-spi, linux-kernel, Aayush Kumar
From: Aayush Kumar <aayushkmx@gmail.com>
Replace simple_strtoul() with kstrtoul() and sprintf() with snprintf()
in three SPI drivers.
Signed-off-by: Aayush Kumar <aayushkmx@gmail.com>
---
Changes in v2:
- Drop the two strcpy() -> strscpy() patches (David Laight).
---
Aayush Kumar (3):
spi: tle62x0: Use kstrtoul() instead of simple_strtoul()
spi: omap2-mcspi: Use snprintf() instead of sprintf()
spi: s3c64xx: Use snprintf() instead of sprintf()
drivers/spi/spi-omap2-mcspi.c | 6 ++++--
drivers/spi/spi-s3c64xx.c | 3 ++-
drivers/spi/spi-tle62x0.c | 6 +++---
3 files changed, 9 insertions(+), 6 deletions(-)
--
2.56.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/3] spi: tle62x0: Use kstrtoul() instead of simple_strtoul()
2026-10-10 8:35 [PATCH v2 0/3] spi: use kstrtoul() and snprintf() Aayush Kumar
@ 2026-10-10 8:35 ` Aayush Kumar
2026-10-10 8:35 ` [PATCH v2 2/3] spi: omap2-mcspi: Use snprintf() instead of sprintf() Aayush Kumar
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Aayush Kumar @ 2026-10-10 8:35 UTC (permalink / raw)
To: Mark Brown; +Cc: David Laight, linux-spi, linux-kernel, Aayush Kumar
From: Aayush Kumar <aayushkmx@gmail.com>
Use the recommended kstrtoul() instead of the deprecated
simple_strtoul(). Check the return value and reject invalid values.
Signed-off-by: Aayush Kumar <aayushkmx@gmail.com>
---
drivers/spi/spi-tle62x0.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-tle62x0.c b/drivers/spi/spi-tle62x0.c
index dd8bfb3f3..986d78ab4 100644
--- a/drivers/spi/spi-tle62x0.c
+++ b/drivers/spi/spi-tle62x0.c
@@ -151,10 +151,10 @@ static ssize_t tle62x0_gpio_store(struct device *dev,
struct tle62x0_state *st = dev_get_drvdata(dev);
int gpio_num = to_gpio_num(attr);
unsigned long val;
- char *endp;
+ int ret;
- val = simple_strtoul(buf, &endp, 0);
- if (buf == endp)
+ ret = kstrtoul(buf, 0, &val);
+ if (ret)
return -EINVAL;
dev_dbg(dev, "setting gpio %d to %ld\n", gpio_num, val);
--
2.56.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/3] spi: omap2-mcspi: Use snprintf() instead of sprintf()
2026-10-10 8:35 [PATCH v2 0/3] spi: use kstrtoul() and snprintf() Aayush Kumar
2026-10-10 8:35 ` [PATCH v2 1/3] spi: tle62x0: Use kstrtoul() instead of simple_strtoul() Aayush Kumar
@ 2026-10-10 8:35 ` Aayush Kumar
2026-10-10 8:35 ` [PATCH v2 3/3] spi: s3c64xx: " Aayush Kumar
2026-10-12 23:20 ` [PATCH v2 0/3] spi: use kstrtoul() and snprintf() Mark Brown
3 siblings, 0 replies; 5+ messages in thread
From: Aayush Kumar @ 2026-10-10 8:35 UTC (permalink / raw)
To: Mark Brown; +Cc: David Laight, linux-spi, linux-kernel, Aayush Kumar
From: Aayush Kumar <aayushkmx@gmail.com>
Use snprintf() instead of sprintf() to avoid potential buffer
overflows when formatting DMA channel names.
Signed-off-by: Aayush Kumar <aayushkmx@gmail.com>
---
drivers/spi/spi-omap2-mcspi.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index a3355147f..311ee0ca9 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1544,8 +1544,10 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
return -ENOMEM;
for (i = 0; i < ctlr->num_chipselect; i++) {
- sprintf(mcspi->dma_channels[i].dma_rx_ch_name, "rx%d", i);
- sprintf(mcspi->dma_channels[i].dma_tx_ch_name, "tx%d", i);
+ snprintf(mcspi->dma_channels[i].dma_rx_ch_name,
+ sizeof(mcspi->dma_channels[i].dma_rx_ch_name), "rx%d", i);
+ snprintf(mcspi->dma_channels[i].dma_tx_ch_name,
+ sizeof(mcspi->dma_channels[i].dma_tx_ch_name), "tx%d", i);
status = omap2_mcspi_request_dma(mcspi,
&mcspi->dma_channels[i]);
--
2.56.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] spi: s3c64xx: Use snprintf() instead of sprintf()
2026-10-10 8:35 [PATCH v2 0/3] spi: use kstrtoul() and snprintf() Aayush Kumar
2026-10-10 8:35 ` [PATCH v2 1/3] spi: tle62x0: Use kstrtoul() instead of simple_strtoul() Aayush Kumar
2026-10-10 8:35 ` [PATCH v2 2/3] spi: omap2-mcspi: Use snprintf() instead of sprintf() Aayush Kumar
@ 2026-10-10 8:35 ` Aayush Kumar
2026-10-12 23:20 ` [PATCH v2 0/3] spi: use kstrtoul() and snprintf() Mark Brown
3 siblings, 0 replies; 5+ messages in thread
From: Aayush Kumar @ 2026-10-10 8:35 UTC (permalink / raw)
To: Mark Brown; +Cc: David Laight, linux-spi, linux-kernel, Aayush Kumar
From: Aayush Kumar <aayushkmx@gmail.com>
Use snprintf() instead of sprintf() to avoid potential buffer
overflows when formatting the clock name.
Signed-off-by: Aayush Kumar <aayushkmx@gmail.com>
---
drivers/spi/spi-s3c64xx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 8d4120cf9..8195bf376 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1331,7 +1331,8 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, PTR_ERR(sdd->clk),
"Unable to acquire clock 'spi'\n");
- sprintf(clk_name, "spi_busclk%d", sci->src_clk_nr);
+ snprintf(clk_name, sizeof(clk_name), "spi_busclk%d",
+ sci->src_clk_nr);
sdd->src_clk = devm_clk_get_enabled(&pdev->dev, clk_name);
if (IS_ERR(sdd->src_clk))
return dev_err_probe(&pdev->dev, PTR_ERR(sdd->src_clk),
--
2.56.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/3] spi: use kstrtoul() and snprintf()
2026-10-10 8:35 [PATCH v2 0/3] spi: use kstrtoul() and snprintf() Aayush Kumar
` (2 preceding siblings ...)
2026-10-10 8:35 ` [PATCH v2 3/3] spi: s3c64xx: " Aayush Kumar
@ 2026-10-12 23:20 ` Mark Brown
3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2026-10-12 23:20 UTC (permalink / raw)
To: Aayush Kumar; +Cc: David Laight, linux-spi, linux-kernel, Aayush Kumar
On Sat, 10 Oct 2026 14:05:01 +0530, Aayush Kumar wrote:
> spi: use kstrtoul() and snprintf()
>
> From: Aayush Kumar <aayushkmx@gmail.com>
>
> Replace simple_strtoul() with kstrtoul() and sprintf() with snprintf()
> in three SPI drivers.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.4
Thanks!
[1/3] spi: tle62x0: Use kstrtoul() instead of simple_strtoul()
https://git.kernel.org/broonie/misc/c/54f4db17f9d3
[2/3] spi: omap2-mcspi: Use snprintf() instead of sprintf()
https://git.kernel.org/broonie/misc/c/9efc388655e4
[3/3] spi: s3c64xx: Use snprintf() instead of sprintf()
https://git.kernel.org/broonie/misc/c/506fbac9274c
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-13 13:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-10 8:35 [PATCH v2 0/3] spi: use kstrtoul() and snprintf() Aayush Kumar
2026-10-10 8:35 ` [PATCH v2 1/3] spi: tle62x0: Use kstrtoul() instead of simple_strtoul() Aayush Kumar
2026-10-10 8:35 ` [PATCH v2 2/3] spi: omap2-mcspi: Use snprintf() instead of sprintf() Aayush Kumar
2026-10-10 8:35 ` [PATCH v2 3/3] spi: s3c64xx: " Aayush Kumar
2026-10-12 23:20 ` [PATCH v2 0/3] spi: use kstrtoul() and snprintf() Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.