From: Thorsten Blum <thorsten.blum@linux.dev>
To: Pablo Neira Ayuso <pablo@netfilter.org>,
Jozsef Kadlecsik <kadlec@netfilter.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next] netfilter: x_tables: Remove unnecessary strscpy() size arguments
Date: Wed, 19 Mar 2025 20:49:33 +0100 [thread overview]
Message-ID: <20250319194934.3801-1-thorsten.blum@linux.dev> (raw)
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;
next reply other threads:[~2025-03-19 19:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-19 19:49 Thorsten Blum [this message]
2025-03-19 21:22 ` [PATCH net-next] netfilter: x_tables: Remove unnecessary strscpy() size arguments Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250319194934.3801-1-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.