All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet.com>
To: David Miller <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	<netdev@vger.kernel.org>
Subject: [PATCH 01/12] xfrm: Remove unnecessary strscpy_pad() size arguments
Date: Fri, 23 May 2025 09:56:00 +0200	[thread overview]
Message-ID: <20250523075611.3723340-2-steffen.klassert@secunet.com> (raw)
In-Reply-To: <20250523075611.3723340-1-steffen.klassert@secunet.com>

From: Thorsten Blum <thorsten.blum@linux.dev>

If the destination buffer has a fixed length, strscpy_pad()
automatically determines 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>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/xfrm/xfrm_user.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 784a2d124749..0a3d3f3ae5a3 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1173,7 +1173,7 @@ static int copy_to_user_auth(struct xfrm_algo_auth *auth, struct sk_buff *skb)
 	if (!nla)
 		return -EMSGSIZE;
 	algo = nla_data(nla);
-	strscpy_pad(algo->alg_name, auth->alg_name, sizeof(algo->alg_name));
+	strscpy_pad(algo->alg_name, auth->alg_name);
 
 	if (redact_secret && auth->alg_key_len)
 		memset(algo->alg_key, 0, (auth->alg_key_len + 7) / 8);
@@ -1186,7 +1186,7 @@ static int copy_to_user_auth(struct xfrm_algo_auth *auth, struct sk_buff *skb)
 	if (!nla)
 		return -EMSGSIZE;
 	ap = nla_data(nla);
-	strscpy_pad(ap->alg_name, auth->alg_name, sizeof(ap->alg_name));
+	strscpy_pad(ap->alg_name, auth->alg_name);
 	ap->alg_key_len = auth->alg_key_len;
 	ap->alg_trunc_len = auth->alg_trunc_len;
 	if (redact_secret && auth->alg_key_len)
@@ -1207,7 +1207,7 @@ static int copy_to_user_aead(struct xfrm_algo_aead *aead, struct sk_buff *skb)
 		return -EMSGSIZE;
 
 	ap = nla_data(nla);
-	strscpy_pad(ap->alg_name, aead->alg_name, sizeof(ap->alg_name));
+	strscpy_pad(ap->alg_name, aead->alg_name);
 	ap->alg_key_len = aead->alg_key_len;
 	ap->alg_icv_len = aead->alg_icv_len;
 
@@ -1229,7 +1229,7 @@ static int copy_to_user_ealg(struct xfrm_algo *ealg, struct sk_buff *skb)
 		return -EMSGSIZE;
 
 	ap = nla_data(nla);
-	strscpy_pad(ap->alg_name, ealg->alg_name, sizeof(ap->alg_name));
+	strscpy_pad(ap->alg_name, ealg->alg_name);
 	ap->alg_key_len = ealg->alg_key_len;
 
 	if (redact_secret && ealg->alg_key_len)
@@ -1250,7 +1250,7 @@ static int copy_to_user_calg(struct xfrm_algo *calg, struct sk_buff *skb)
 		return -EMSGSIZE;
 
 	ap = nla_data(nla);
-	strscpy_pad(ap->alg_name, calg->alg_name, sizeof(ap->alg_name));
+	strscpy_pad(ap->alg_name, calg->alg_name);
 	ap->alg_key_len = 0;
 
 	return 0;
-- 
2.34.1


  reply	other threads:[~2025-05-23  7:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23  7:55 [PATCH 0/12] pull request (net-next): ipsec-next 2025-05-23 Steffen Klassert
2025-05-23  7:56 ` Steffen Klassert [this message]
2025-05-26 16:50   ` [PATCH 01/12] xfrm: Remove unnecessary strscpy_pad() size arguments patchwork-bot+netdevbpf
2025-05-23  7:56 ` [PATCH 02/12] net/mlx5: Avoid using xso.real_dev unnecessarily Steffen Klassert
2025-05-23  7:56 ` [PATCH 03/12] xfrm: Use xdo.dev instead of xdo.real_dev Steffen Klassert
2025-05-23  7:56 ` [PATCH 04/12] xfrm: Remove unneeded device check from validate_xmit_xfrm Steffen Klassert
2025-05-23  7:56 ` [PATCH 05/12] xfrm: Add explicit dev to .xdo_dev_state_{add,delete,free} Steffen Klassert
2025-05-23  7:56 ` [PATCH 06/12] bonding: Mark active offloaded xfrm_states Steffen Klassert
2025-05-23  7:56 ` [PATCH 07/12] bonding: Fix multiple long standing offload races Steffen Klassert
2025-05-23  7:56 ` [PATCH 08/12] xfrm: Migrate offload configuration Steffen Klassert
2025-05-23  7:56 ` [PATCH 09/12] xfrm: Refactor migration setup during the cloning process Steffen Klassert
2025-05-23  7:56 ` [PATCH 10/12] xfrm: validate assignment of maximal possible SEQ number Steffen Klassert
2025-05-23  7:56 ` [PATCH 11/12] xfrm: prevent configuration of interface index when offload is used Steffen Klassert
2025-05-23  7:56 ` [PATCH 12/12] xfrm: use kfree_sensitive() for SA secret zeroization Steffen Klassert
2025-05-23 10:36 ` [PATCH 0/12] pull request (net-next): ipsec-next 2025-05-23 Steffen Klassert

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=20250523075611.3723340-2-steffen.klassert@secunet.com \
    --to=steffen.klassert@secunet.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.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.