summaryrefslogtreecommitdiff
path: root/crypto/skcipher.c
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2026-05-08 12:57:17 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2026-05-15 18:08:48 +0800
commit6b261b9bae589b8bbcaca5ededc0caf0b2f3a0af (patch)
tree93bb57c0186b3183515aed8ce1e9487fb45e2a53 /crypto/skcipher.c
parentc36faca103a685590281412e47df74b550f71886 (diff)
downloadlinux-next-6b261b9bae589b8bbcaca5ededc0caf0b2f3a0af.tar.gz
linux-next-6b261b9bae589b8bbcaca5ededc0caf0b2f3a0af.zip
crypto: api - use designated initializers for report structs
Use designated initializers for the report structs instead of clearing the struct with memset() and then copying fixed strings with strscpy() at runtime. This keeps the structs zero-initialized, lets the compiler diagnose oversized string literals, and makes the code easier to read. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/skcipher.c')
-rw-r--r--crypto/skcipher.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/crypto/skcipher.c b/crypto/skcipher.c
index 2b31d1d5d268..617e840432b1 100644
--- a/crypto/skcipher.c
+++ b/crypto/skcipher.c
@@ -591,12 +591,10 @@ static int __maybe_unused crypto_skcipher_report(
struct sk_buff *skb, struct crypto_alg *alg)
{
struct skcipher_alg *skcipher = __crypto_skcipher_alg(alg);
- struct crypto_report_blkcipher rblkcipher;
-
- memset(&rblkcipher, 0, sizeof(rblkcipher));
-
- strscpy(rblkcipher.type, "skcipher", sizeof(rblkcipher.type));
- strscpy(rblkcipher.geniv, "<none>", sizeof(rblkcipher.geniv));
+ struct crypto_report_blkcipher rblkcipher = {
+ .type = "skcipher",
+ .geniv = "<none>",
+ };
rblkcipher.blocksize = alg->cra_blocksize;
rblkcipher.min_keysize = skcipher->min_keysize;