[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250319194934.3801-1-thorsten.blum@linux.dev>
Date: Wed, 19 Mar 2025 20:49:33 +0100
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Pablo Neira Ayuso <pablo@...filter.org>,
Jozsef Kadlecsik <kadlec@...filter.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>,
netfilter-devel@...r.kernel.org,
coreteam@...filter.org,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH net-next] netfilter: x_tables: Remove unnecessary strscpy() size arguments
If the destination buffer has a fixed length, both strscpy_pad() and
strscpy() automatically determine its size using sizeof() when the
argument is omitted. This makes the explicit sizeof() calls unnecessary.
Remove them.
No functional changes intended.
Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
---
net/netfilter/x_tables.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 709840612f0d..8607852dadec 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -766,9 +766,9 @@ void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
msize += off;
m->u.user.match_size = msize;
- strscpy(name, match->name, sizeof(name));
+ strscpy(name, match->name);
module_put(match->me);
- strscpy_pad(m->u.user.name, name, sizeof(m->u.user.name));
+ strscpy_pad(m->u.user.name, name);
*size += off;
*dstptr += msize;
@@ -1147,9 +1147,9 @@ void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr,
tsize += off;
t->u.user.target_size = tsize;
- strscpy(name, target->name, sizeof(name));
+ strscpy(name, target->name);
module_put(target->me);
- strscpy_pad(t->u.user.name, name, sizeof(t->u.user.name));
+ strscpy_pad(t->u.user.name, name);
*size += off;
*dstptr += tsize;
Powered by blists - more mailing lists