Skip to content

Commit 20eb35d

Browse files
tobluxklassert
authored andcommitted
xfrm: Remove unnecessary strscpy_pad() size arguments
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 <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent 0c49baf commit 20eb35d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

net/xfrm/xfrm_user.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ static int copy_to_user_auth(struct xfrm_algo_auth *auth, struct sk_buff *skb)
11731173
if (!nla)
11741174
return -EMSGSIZE;
11751175
algo = nla_data(nla);
1176-
strscpy_pad(algo->alg_name, auth->alg_name, sizeof(algo->alg_name));
1176+
strscpy_pad(algo->alg_name, auth->alg_name);
11771177

11781178
if (redact_secret && auth->alg_key_len)
11791179
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)
11861186
if (!nla)
11871187
return -EMSGSIZE;
11881188
ap = nla_data(nla);
1189-
strscpy_pad(ap->alg_name, auth->alg_name, sizeof(ap->alg_name));
1189+
strscpy_pad(ap->alg_name, auth->alg_name);
11901190
ap->alg_key_len = auth->alg_key_len;
11911191
ap->alg_trunc_len = auth->alg_trunc_len;
11921192
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)
12071207
return -EMSGSIZE;
12081208

12091209
ap = nla_data(nla);
1210-
strscpy_pad(ap->alg_name, aead->alg_name, sizeof(ap->alg_name));
1210+
strscpy_pad(ap->alg_name, aead->alg_name);
12111211
ap->alg_key_len = aead->alg_key_len;
12121212
ap->alg_icv_len = aead->alg_icv_len;
12131213

@@ -1229,7 +1229,7 @@ static int copy_to_user_ealg(struct xfrm_algo *ealg, struct sk_buff *skb)
12291229
return -EMSGSIZE;
12301230

12311231
ap = nla_data(nla);
1232-
strscpy_pad(ap->alg_name, ealg->alg_name, sizeof(ap->alg_name));
1232+
strscpy_pad(ap->alg_name, ealg->alg_name);
12331233
ap->alg_key_len = ealg->alg_key_len;
12341234

12351235
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)
12501250
return -EMSGSIZE;
12511251

12521252
ap = nla_data(nla);
1253-
strscpy_pad(ap->alg_name, calg->alg_name, sizeof(ap->alg_name));
1253+
strscpy_pad(ap->alg_name, calg->alg_name);
12541254
ap->alg_key_len = 0;
12551255

12561256
return 0;

0 commit comments

Comments
 (0)