mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
s390/iucv: Convert sprintf/snprintf to scnprintf
Convert sprintf/snprintf calls to scnprintf to better align with the kernel development community practices [1]. Link: https://lwn.net/Articles/69419 [1] Reviewed-by: Alexandra Winter <wintera@linux.ibm.com> Signed-off-by: Aswin Karuvally <aswin@linux.ibm.com> Signed-off-by: Alexandra Winter <wintera@linux.ibm.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20251017094954.1402684-1-wintera@linux.ibm.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
baa515ef82
commit
38516e3fa4
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user