aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/crypto_user_stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/crypto_user_stat.c')
-rw-r--r--crypto/crypto_user_stat.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/crypto/crypto_user_stat.c b/crypto/crypto_user_stat.c
index 021ad06bbb62..1dfaa0ccd555 100644
--- a/crypto/crypto_user_stat.c
+++ b/crypto/crypto_user_stat.c
@@ -37,6 +37,8 @@ static int crypto_report_aead(struct sk_buff *skb, struct crypto_alg *alg)
37 u64 v64; 37 u64 v64;
38 u32 v32; 38 u32 v32;
39 39
40 memset(&raead, 0, sizeof(raead));
41
40 strncpy(raead.type, "aead", sizeof(raead.type)); 42 strncpy(raead.type, "aead", sizeof(raead.type));
41 43
42 v32 = atomic_read(&alg->encrypt_cnt); 44 v32 = atomic_read(&alg->encrypt_cnt);
@@ -65,6 +67,8 @@ static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg)
65 u64 v64; 67 u64 v64;
66 u32 v32; 68 u32 v32;
67 69
70 memset(&rcipher, 0, sizeof(rcipher));
71
68 strlcpy(rcipher.type, "cipher", sizeof(rcipher.type)); 72 strlcpy(rcipher.type, "cipher", sizeof(rcipher.type));
69 73
70 v32 = atomic_read(&alg->encrypt_cnt); 74 v32 = atomic_read(&alg->encrypt_cnt);
@@ -93,6 +97,8 @@ static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg)
93 u64 v64; 97 u64 v64;
94 u32 v32; 98 u32 v32;
95 99
100 memset(&rcomp, 0, sizeof(rcomp));
101
96 strlcpy(rcomp.type, "compression", sizeof(rcomp.type)); 102 strlcpy(rcomp.type, "compression", sizeof(rcomp.type));
97 v32 = atomic_read(&alg->compress_cnt); 103 v32 = atomic_read(&alg->compress_cnt);
98 rcomp.stat_compress_cnt = v32; 104 rcomp.stat_compress_cnt = v32;
@@ -120,6 +126,8 @@ static int crypto_report_acomp(struct sk_buff *skb, struct crypto_alg *alg)
120 u64 v64; 126 u64 v64;
121 u32 v32; 127 u32 v32;
122 128
129 memset(&racomp, 0, sizeof(racomp));
130
123 strlcpy(racomp.type, "acomp", sizeof(racomp.type)); 131 strlcpy(racomp.type, "acomp", sizeof(racomp.type));
124 v32 = atomic_read(&alg->compress_cnt); 132 v32 = atomic_read(&alg->compress_cnt);
125 racomp.stat_compress_cnt = v32; 133 racomp.stat_compress_cnt = v32;
@@ -147,6 +155,8 @@ static int crypto_report_akcipher(struct sk_buff *skb, struct crypto_alg *alg)
147 u64 v64; 155 u64 v64;
148 u32 v32; 156 u32 v32;
149 157
158 memset(&rakcipher, 0, sizeof(rakcipher));
159
150 strncpy(rakcipher.type, "akcipher", sizeof(rakcipher.type)); 160 strncpy(rakcipher.type, "akcipher", sizeof(rakcipher.type));
151 v32 = atomic_read(&alg->encrypt_cnt); 161 v32 = atomic_read(&alg->encrypt_cnt);
152 rakcipher.stat_encrypt_cnt = v32; 162 rakcipher.stat_encrypt_cnt = v32;
@@ -177,6 +187,8 @@ static int crypto_report_kpp(struct sk_buff *skb, struct crypto_alg *alg)
177 struct crypto_stat rkpp; 187 struct crypto_stat rkpp;
178 u32 v; 188 u32 v;
179 189
190 memset(&rkpp, 0, sizeof(rkpp));
191
180 strlcpy(rkpp.type, "kpp", sizeof(rkpp.type)); 192 strlcpy(rkpp.type, "kpp", sizeof(rkpp.type));
181 193
182 v = atomic_read(&alg->setsecret_cnt); 194 v = atomic_read(&alg->setsecret_cnt);
@@ -203,6 +215,8 @@ static int crypto_report_ahash(struct sk_buff *skb, struct crypto_alg *alg)
203 u64 v64; 215 u64 v64;
204 u32 v32; 216 u32 v32;
205 217
218 memset(&rhash, 0, sizeof(rhash));
219
206 strncpy(rhash.type, "ahash", sizeof(rhash.type)); 220 strncpy(rhash.type, "ahash", sizeof(rhash.type));
207 221
208 v32 = atomic_read(&alg->hash_cnt); 222 v32 = atomic_read(&alg->hash_cnt);
@@ -227,6 +241,8 @@ static int crypto_report_shash(struct sk_buff *skb, struct crypto_alg *alg)
227 u64 v64; 241 u64 v64;
228 u32 v32; 242 u32 v32;
229 243
244 memset(&rhash, 0, sizeof(rhash));
245
230 strncpy(rhash.type, "shash", sizeof(rhash.type)); 246 strncpy(rhash.type, "shash", sizeof(rhash.type));
231 247
232 v32 = atomic_read(&alg->hash_cnt); 248 v32 = atomic_read(&alg->hash_cnt);
@@ -251,6 +267,8 @@ static int crypto_report_rng(struct sk_buff *skb, struct crypto_alg *alg)
251 u64 v64; 267 u64 v64;
252 u32 v32; 268 u32 v32;
253 269
270 memset(&rrng, 0, sizeof(rrng));
271
254 strncpy(rrng.type, "rng", sizeof(rrng.type)); 272 strncpy(rrng.type, "rng", sizeof(rrng.type));
255 273
256 v32 = atomic_read(&alg->generate_cnt); 274 v32 = atomic_read(&alg->generate_cnt);
@@ -275,6 +293,8 @@ static int crypto_reportstat_one(struct crypto_alg *alg,
275 struct crypto_user_alg *ualg, 293 struct crypto_user_alg *ualg,
276 struct sk_buff *skb) 294 struct sk_buff *skb)
277{ 295{
296 memset(ualg, 0, sizeof(*ualg));
297
278 strlcpy(ualg->cru_name, alg->cra_name, sizeof(ualg->cru_name)); 298 strlcpy(ualg->cru_name, alg->cra_name, sizeof(ualg->cru_name));
279 strlcpy(ualg->cru_driver_name, alg->cra_driver_name, 299 strlcpy(ualg->cru_driver_name, alg->cra_driver_name,
280 sizeof(ualg->cru_driver_name)); 300 sizeof(ualg->cru_driver_name));
@@ -291,6 +311,7 @@ static int crypto_reportstat_one(struct crypto_alg *alg,
291 if (alg->cra_flags & CRYPTO_ALG_LARVAL) { 311 if (alg->cra_flags & CRYPTO_ALG_LARVAL) {
292 struct crypto_stat rl; 312 struct crypto_stat rl;
293 313
314 memset(&rl, 0, sizeof(rl));
294 strlcpy(rl.type, "larval", sizeof(rl.type)); 315 strlcpy(rl.type, "larval", sizeof(rl.type));
295 if (nla_put(skb, CRYPTOCFGA_STAT_LARVAL, 316 if (nla_put(skb, CRYPTOCFGA_STAT_LARVAL,
296 sizeof(struct crypto_stat), &rl)) 317 sizeof(struct crypto_stat), &rl))