Skip to contentSkip to conversation

s390/iucv: Convert sprintf/snprintf to scnprintf

PATCH Applied Alexandra Winter 3 participants 3 messages Oct 17, 2025 – Oct 21, 2025

Subsystems (5)
lore
Share & tools
lore

Alexandra Winter

author maintainer
#0 lore raw

PATCH 1/1 s390/iucv: Convert sprintf/snprintf to scnprintf

From: Aswin Karuvally <[email protected]>

Convert sprintf/snprintf calls to scnprintf to better align with the kernel development community practices [1].

---
 drivers/s390/net/smsgiucv_app.c | 7 ++++---
 net/iucv/af_iucv.c              | 7 ++++---
 net/iucv/iucv.c                 | 2 +-
 3 files changed, 9 insertions(+), 7 deletions(-)
drivers/s390/net/smsgiucv_app.c +4 -3
index 4bd4d6bfc126..768108c90b32 100644
@@ -88,9 +88,10 @@ static struct smsg_app_event *smsg_app_event_alloc(const char *from,
 	ev->envp[3] = NULL;
 
 	/* setting up environment: sender, prefix name, and message text */
-	snprintf(ev->envp[0], ENV_SENDER_LEN, ENV_SENDER_STR "%s", from);
-	snprintf(ev->envp[1], ENV_PREFIX_LEN, ENV_PREFIX_STR "%s", SMSG_PREFIX);
-	snprintf(ev->envp[2], ENV_TEXT_LEN(msg), ENV_TEXT_STR "%s", msg);
+	scnprintf(ev->envp[0], ENV_SENDER_LEN, ENV_SENDER_STR "%s", from);
+	scnprintf(ev->envp[1], ENV_PREFIX_LEN, ENV_PREFIX_STR "%s",
+		  SMSG_PREFIX);
+	scnprintf(ev->envp[2], ENV_TEXT_LEN(msg), ENV_TEXT_STR "%s", msg);
 
 	return ev;
 }
net/iucv/af_iucv.c +4 -3
index 6c717a7ef292..4ddfc633d30c 100644
@@ -553,10 +553,11 @@ static void __iucv_auto_name(struct iucv_sock *iucv)
 {
 	char name[12];
 
-	sprintf(name, "%08x", atomic_inc_return(&iucv_sk_list.autobind_name));
+	scnprintf(name, sizeof(name),
+		  "%08x", atomic_inc_return(&iucv_sk_list.autobind_name));
 	while (__iucv_get_sock_by_name(name)) {
-		sprintf(name, "%08x",
-			atomic_inc_return(&iucv_sk_list.autobind_name));
+		scnprintf(name, sizeof(name), "%08x",
+			  atomic_inc_return(&iucv_sk_list.autobind_name));
 	}
 	memcpy(iucv->src_name, name, 8);
 }
net/iucv/iucv.c +1 -1
index 473a7847d80b..008be0abe3a5 100644
@@ -95,7 +95,7 @@ struct device *iucv_alloc_device(const struct attribute_group **attrs,
 	if (!dev)
 		goto out_error;
 	va_start(vargs, fmt);
-	vsnprintf(buf, sizeof(buf), fmt, vargs);
+	vscnprintf(buf, sizeof(buf), fmt, vargs);
 	rc = dev_set_name(dev, "%s", buf);
 	va_end(vargs);
 	if (rc)
Signature · 1 line
2.48.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Alexandra Winter

From: Aswin Karuvally <[email protected]>

Convert sprintf/snprintf calls to scnprintf to better align with the kernel development community practices [1].

#2 lore raw
In reply to Alexandra Winter
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Fri, 17 Oct 2025 11:49:54 +0200 you wrote:

From: Aswin Karuvally <[email protected]>

Convert sprintf/snprintf calls to scnprintf to better align with the kernel development community practices [1].

[...]

Here is the summary with links:
- [net-next] s390/iucv: Convert sprintf/snprintf to scnprintf

    https://git.kernel.org/netdev/net-next/c/38516e3fa4ca

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html