* [PATCH net-next] netfilter: x_tables: Remove unnecessary strscpy() size arguments
@ 2025-03-19 19:49 Thorsten Blum
2025-03-19 21:22 ` Florian Westphal
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2025-03-19 19:49 UTC (permalink / raw)
To: Pablo Neira Ayuso, Jozsef Kadlecsik, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman
Cc: Thorsten Blum, netfilter-devel, coreteam, netdev, linux-kernel
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@linux.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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] netfilter: x_tables: Remove unnecessary strscpy() size arguments
2025-03-19 19:49 [PATCH net-next] netfilter: x_tables: Remove unnecessary strscpy() size arguments Thorsten Blum
@ 2025-03-19 21:22 ` Florian Westphal
0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2025-03-19 21:22 UTC (permalink / raw)
To: Thorsten Blum
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
netfilter-devel, coreteam, netdev, linux-kernel
Thorsten Blum <thorsten.blum@linux.dev> wrote:
> 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.
Sorry, not going to ack this, IMO this is just useless noise.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-19 21:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-19 19:49 [PATCH net-next] netfilter: x_tables: Remove unnecessary strscpy() size arguments Thorsten Blum
2025-03-19 21:22 ` Florian Westphal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).