aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/crypto_user.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-04-01 20:19:05 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-02 04:33:42 -0400
commit6662df33f85b87bb29f2ecad124efe7bb2c08e05 (patch)
tree13c8ac420b8d10ec3a7aa9aa7fdaa221e430c9cc /crypto/crypto_user.c
parentb21dddb9dfe50ca1e205faf4b25900895494d25b (diff)
crypto: Stop using NLA_PUT*().
These macros contain a hidden goto, and are thus extremely error prone and make code hard to audit. Signed-off-by: David S. Miller <davem@davemloft.net>
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 f76e42bcc6e7..84a5ac71ecb4 100644
--- a/crypto/crypto_user.c
+++ b/crypto/crypto_user.c
@@ -77,9 +77,9 @@ static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg)
77 rcipher.min_keysize = alg->cra_cipher.cia_min_keysize; 77 rcipher.min_keysize = alg->cra_cipher.cia_min_keysize;
78 rcipher.max_keysize = alg->cra_cipher.cia_max_keysize; 78 rcipher.max_keysize = alg->cra_cipher.cia_max_keysize;
79 79
80 NLA_PUT(skb, CRYPTOCFGA_REPORT_CIPHER, 80 if (nla_put(skb, CRYPTOCFGA_REPORT_CIPHER,
81 sizeof(struct crypto_report_cipher), &rcipher); 81 sizeof(struct crypto_report_cipher), &rcipher))
82 82 goto nla_put_failure;
83 return 0; 83 return 0;
84 84
85nla_put_failure: 85nla_put_failure:
@@ -92,9 +92,9 @@ static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg)
92 92
93 snprintf(rcomp.type, CRYPTO_MAX_ALG_NAME, "%s", "compression"); 93 snprintf(rcomp.type, CRYPTO_MAX_ALG_NAME, "%s", "compression");
94 94
95 NLA_PUT(skb, CRYPTOCFGA_REPORT_COMPRESS, 95 if (nla_put(skb, CRYPTOCFGA_REPORT_COMPRESS,
96 sizeof(struct crypto_report_comp), &rcomp); 96 sizeof(struct crypto_report_comp), &rcomp))
97 97 goto nla_put_failure;
98 return 0; 98 return 0;
99 99
100nla_put_failure: 100nla_put_failure:
@@ -113,16 +113,16 @@ static int crypto_report_one(struct crypto_alg *alg,
113 ualg->cru_flags = alg->cra_flags; 113 ualg->cru_flags = alg->cra_flags;
114 ualg->cru_refcnt = atomic_read(&alg->cra_refcnt); 114 ualg->cru_refcnt = atomic_read(&alg->cra_refcnt);
115 115
116 NLA_PUT_U32(skb, CRYPTOCFGA_PRIORITY_VAL, alg->cra_priority); 116 if (nla_put_u32(skb, CRYPTOCFGA_PRIORITY_VAL, alg->cra_priority))
117 117 goto nla_put_failure;
118 if (alg->cra_flags & CRYPTO_ALG_LARVAL) { 118 if (alg->cra_flags & CRYPTO_ALG_LARVAL) {
119 struct crypto_report_larval rl; 119 struct crypto_report_larval rl;
120 120
121 snprintf(rl.type, CRYPTO_MAX_ALG_NAME, "%s", "larval"); 121 snprintf(rl.type, CRYPTO_MAX_ALG_NAME, "%s", "larval");
122 122
123 NLA_PUT(skb, CRYPTOCFGA_REPORT_LARVAL, 123 if (nla_put(skb, CRYPTOCFGA_REPORT_LARVAL,
124 sizeof(struct crypto_report_larval), &rl); 124 sizeof(struct crypto_report_larval), &rl))
125 125 goto nla_put_failure;
126 goto out; 126 goto out;
127 } 127 }
128 128