From: Jules Maselbas <jmaselbas@zdiv.net>
To: barebox@lists.infradead.org
Cc: Jules Maselbas <jmaselbas@zdiv.net>
Subject: [PATCH 2/6] dma-devices: k3-udma: use snprintf instead of sprintf
Date: Fri, 14 Mar 2025 11:40:30 +0100 [thread overview]
Message-ID: <20250314104034.13637-3-jmaselbas@zdiv.net> (raw)
In-Reply-To: <20250314104034.13637-1-jmaselbas@zdiv.net>
Replace the use of sprintf by snprintf, in this case sprintf could not
overflow because the size of uc::name is well chosen to be able to fit
the largest u32 integer.
Signed-off-by: Jules Maselbas <jmaselbas@zdiv.net>
---
drivers/dma/ti/k3-udma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index 8f46364145..d32ed46b0f 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -2678,7 +2678,7 @@ static int k3_udma_probe(struct device *dev)
uc->config.mapped_channel_id = -1;
uc->config.default_flow_id = -1;
uc->config.dir = DMA_MEM_TO_MEM;
- sprintf(uc->name, "UDMA chan%d\n", i);
+ snprintf(uc->name, sizeof(uc->name), "UDMA chan%d\n", i);
if (!i)
uc->in_use = true;
}
--
2.48.1
next prev parent reply other threads:[~2025-03-14 11:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 10:40 [PATCH 0/6] compile test fixes Jules Maselbas
2025-03-14 10:40 ` [PATCH 1/6] dma-devices: k3-udma: cleanup headers Jules Maselbas
2025-03-14 10:40 ` Jules Maselbas [this message]
2025-03-14 10:40 ` [PATCH 3/6] mfd: tps65219: add missing include Jules Maselbas
2025-03-14 10:40 ` [PATCH 4/6] pmdomain: ti-k3: " Jules Maselbas
2025-03-14 10:40 ` [PATCH 5/6] pmdomain: ti-k3: remove trailing whitespace Jules Maselbas
2025-03-14 10:40 ` [PATCH 6/6] regulator: tps65219: add missing include Jules Maselbas
2025-03-14 13:08 ` [PATCH 0/6] compile test fixes Ahmad Fatoum
2025-03-14 14:43 ` Jules Maselbas
2025-03-14 14:49 ` Ahmad Fatoum
2025-03-14 15:00 ` Jules Maselbas
2025-03-14 15:09 ` [PATCH v2 0/3] compile test cleanups Jules Maselbas
2025-03-14 15:09 ` [PATCH v2 1/3] dma-devices: k3-udma: remove duplicated include Jules Maselbas
2025-03-14 15:09 ` [PATCH v2 2/3] dma-devices: k3-udma: use snprintf instead of sprintf Jules Maselbas
2025-03-14 15:09 ` [PATCH v2 3/3] pmdomain: ti-k3: remove trailing whitespace Jules Maselbas
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=20250314104034.13637-3-jmaselbas@zdiv.net \
--to=jmaselbas@zdiv.net \
--cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox