summaryrefslogtreecommitdiff
path: root/crypto/scompress.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/scompress.c
parentc36faca103a685590281412e47df74b550f71886 (diff)
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/scompress.c')
-rw-r--r--crypto/scompress.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/crypto/scompress.c b/crypto/scompress.c
index 253655ece83f..de54227203ce 100644
--- a/crypto/scompress.c
+++ b/crypto/scompress.c
@@ -48,11 +48,9 @@ static DECLARE_WORK(scomp_scratch_work, scomp_scratch_workfn);
static int __maybe_unused crypto_scomp_report(
struct sk_buff *skb, struct crypto_alg *alg)
{
- struct crypto_report_comp rscomp;
-
- memset(&rscomp, 0, sizeof(rscomp));
-
- strscpy(rscomp.type, "scomp", sizeof(rscomp.type));
+ struct crypto_report_comp rscomp = {
+ .type = "scomp",
+ };
return nla_put(skb, CRYPTOCFGA_REPORT_COMPRESS,
sizeof(rscomp), &rscomp);