aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/crypto_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/crypto_user.c')
-rw-r--r--crypto/crypto_user.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c
index 35d700a97d79..f6d9baf77f0a 100644
--- a/crypto/crypto_user.c
+++ b/crypto/crypto_user.c
@@ -75,7 +75,7 @@ static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg)
75{ 75{
76 struct crypto_report_cipher rcipher; 76 struct crypto_report_cipher rcipher;
77 77
78 snprintf(rcipher.type, CRYPTO_MAX_ALG_NAME, "%s", "cipher"); 78 strncpy(rcipher.type, "cipher", sizeof(rcipher.type));
79 79
80 rcipher.blocksize = alg->cra_blocksize; 80 rcipher.blocksize = alg->cra_blocksize;
81 rcipher.min_keysize = alg->cra_cipher.cia_min_keysize; 81 rcipher.min_keysize = alg->cra_cipher.cia_min_keysize;
@@ -94,8 +94,7 @@ static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg)
94{ 94{
95 struct crypto_report_comp rcomp; 95 struct crypto_report_comp rcomp;
96 96
97 snprintf(rcomp.type, CRYPTO_MAX_ALG_NAME, "%s", "compression"); 97 strncpy(rcomp.type, "compression", sizeof(rcomp.type));
98
99 if (nla_put(skb, CRYPTOCFGA_REPORT_COMPRESS, 98 if (nla_put(skb, CRYPTOCFGA_REPORT_COMPRESS,
100 sizeof(struct crypto_report_comp), &rcomp)) 99 sizeof(struct crypto_report_comp), &rcomp))
101 goto nla_put_failure; 100 goto nla_put_failure;
@@ -108,12 +107,14 @@ nla_put_failure:
108static int crypto_report_one(struct crypto_alg *alg, 107static int crypto_report_one(struct crypto_alg *alg,
109 struct crypto_user_alg *ualg, struct sk_buff *skb) 108 struct crypto_user_alg *ualg, struct sk_buff *skb)
110{ 109{
111 memcpy(&ualg->cru_name, &alg->cra_name, sizeof(ualg->cru_name)); 110 strncpy(ualg->cru_name, alg->cra_name, sizeof(ualg->cru_name));
112 memcpy(&ualg->cru_driver_name, &alg->cra_driver_name, 111 strncpy(ualg->cru_driver_name, alg->cra_driver_name,
113 sizeof(ualg->cru_driver_name)); 112 sizeof(ualg->cru_driver_name));
114 memcpy(&ualg->cru_module_name, module_name(alg->cra_module), 113 strncpy(ualg->cru_module_name, module_name(alg->cra_module),
115 CRYPTO_MAX_ALG_NAME); 114 sizeof(ualg->cru_module_name));
116 115
116 ualg->cru_type = 0;
117 ualg->cru_mask = 0;
117 ualg->cru_flags = alg->cra_flags; 118 ualg->cru_flags = alg->cra_flags;
118 ualg->cru_refcnt = atomic_read(&alg->cra_refcnt); 119 ualg->cru_refcnt = atomic_read(&alg->cra_refcnt);
119 120
@@ -122,8 +123,7 @@ static int crypto_report_one(struct crypto_alg *alg,
122 if (alg->cra_flags & CRYPTO_ALG_LARVAL) { 123 if (alg->cra_flags & CRYPTO_ALG_LARVAL) {
123 struct crypto_report_larval rl; 124 struct crypto_report_larval rl;
124 125
125 snprintf(rl.type, CRYPTO_MAX_ALG_NAME, "%s", "larval"); 126 strncpy(rl.type, "larval", sizeof(rl.type));
126
127 if (nla_put(skb, CRYPTOCFGA_REPORT_LARVAL, 127 if (nla_put(skb, CRYPTOCFGA_REPORT_LARVAL,
128 sizeof(struct crypto_report_larval), &rl)) 128 sizeof(struct crypto_report_larval), &rl))
129 goto nla_put_failure; 129 goto nla_put_failure;