From: Aayush Kumar <code@aayushk.dev>
To: broonie@kernel.org
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
Aayush Kumar <code@aayushk.dev>
Subject: [PATCH 5/5] spi: s3c64xx: Use snprintf() instead of sprintf()
Date: Fri, 9 Oct 2026 19:06:09 +0530 [thread overview]
Message-ID: <20261009133609.579046-6-code@aayushk.dev> (raw)
In-Reply-To: <20261009133609.579046-1-code@aayushk.dev>
Use snprintf() instead of sprintf() to avoid potential buffer
overflows when formatting the clock name.
Signed-off-by: Aayush Kumar <code@aayushk.dev>
---
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
prev parent reply other threads:[~2026-10-09 13:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 13:36 [PATCH 0/5] spi: replace strcpy(), sprintf() and simple_strtoul() with strscpy(), snprintf() and kstrtoul() Aayush Kumar
2026-10-09 13:36 ` [PATCH 1/5] spi: butterfly: Use strscpy() instead of strcpy() Aayush Kumar
2026-10-09 13:36 ` [PATCH 2/5] spi: lm70llp: " Aayush Kumar
2026-10-09 14:28 ` David Laight
2026-10-09 17:13 ` Aayush Kumar
2026-10-09 13:36 ` [PATCH 3/5] spi: tle62x0: Use kstrtoul() instead of simple_strtoul() Aayush Kumar
2026-10-09 13:36 ` [PATCH 4/5] spi: omap2-mcspi: Use snprintf() instead of sprintf() Aayush Kumar
2026-10-09 13:36 ` Aayush Kumar [this message]
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=20261009133609.579046-6-code@aayushk.dev \
--to=code@aayushk.dev \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/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 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.