diff mbox series

[net-next] netfilter: x_tables: Remove unnecessary strscpy() size arguments

Message ID 20250319194934.3801-1-thorsten.blum@linux.dev (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series [net-next] netfilter: x_tables: Remove unnecessary strscpy() size arguments | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 22 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 4 this patch: 4
netdev/source_inline success Was 0 now: 0
netdev/contest fail net-next-2025-03-20--03-00 (tests: 896)

Commit Message

Thorsten Blum March 19, 2025, 7:49 p.m. UTC
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(-)

Comments

Florian Westphal March 19, 2025, 9:22 p.m. UTC | #1
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.
diff mbox series

Patch

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;