[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240828030321.20688-8-laoar.shao@gmail.com>
Date: Wed, 28 Aug 2024 11:03:20 +0800
From: Yafang Shao <laoar.shao@...il.com>
To: akpm@...ux-foundation.org
Cc: torvalds@...ux-foundation.org,
alx@...nel.org,
justinstitt@...gle.com,
ebiederm@...ssion.com,
alexei.starovoitov@...il.com,
rostedt@...dmis.org,
catalin.marinas@....com,
penguin-kernel@...ove.sakura.ne.jp,
linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org,
audit@...r.kernel.org,
linux-security-module@...r.kernel.org,
selinux@...r.kernel.org,
bpf@...r.kernel.org,
netdev@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
Yafang Shao <laoar.shao@...il.com>,
"David S. Miller" <davem@...emloft.net>,
David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Subject: [PATCH v8 7/8] net: Replace strcpy() with strscpy()
To prevent errors from occurring when the src string is longer than the dst
string in strcpy(), we should use strscpy() instead. This approach
also facilitates future extensions to the task comm.
Signed-off-by: Yafang Shao <laoar.shao@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>
Cc: David Ahern <dsahern@...nel.org>
Cc: Eric Dumazet <edumazet@...gle.com>
Cc: Jakub Kicinski <kuba@...nel.org>
Cc: Paolo Abeni <pabeni@...hat.com>
---
net/ipv6/ndisc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index b8eec1b6cc2c..cf7c36463b33 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1944,7 +1944,7 @@ static void ndisc_warn_deprecated_sysctl(const struct ctl_table *ctl,
static char warncomm[TASK_COMM_LEN];
static int warned;
if (strcmp(warncomm, current->comm) && warned < 5) {
- strcpy(warncomm, current->comm);
+ strscpy(warncomm, current->comm);
pr_warn("process `%s' is using deprecated sysctl (%s) net.ipv6.neigh.%s.%s - use net.ipv6.neigh.%s.%s_ms instead\n",
warncomm, func,
dev_name, ctl->procname,
--
2.43.5
Powered by blists - more mailing lists