summaryrefslogtreecommitdiffstats
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)
downloadop-kernel-dev-6662df33f85b87bb29f2ecad124efe7bb2c08e05.zip
op-kernel-dev-6662df33f85b87bb29f2ecad124efe7bb2c08e05.tar.gz
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 f76e42b..84a5ac7 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)
rcipher.min_keysize = alg->cra_cipher.cia_min_keysize;
rcipher.max_keysize = alg->cra_cipher.cia_max_keysize;
- NLA_PUT(skb, CRYPTOCFGA_REPORT_CIPHER,
- sizeof(struct crypto_report_cipher), &rcipher);
-
+ if (nla_put(skb, CRYPTOCFGA_REPORT_CIPHER,
+ sizeof(struct crypto_report_cipher), &rcipher))
+ goto nla_put_failure;
return 0;
nla_put_failure:
@@ -92,9 +92,9 @@ static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg)
snprintf(rcomp.type, CRYPTO_MAX_ALG_NAME, "%s", "compression");
- NLA_PUT(skb, CRYPTOCFGA_REPORT_COMPRESS,
- sizeof(struct crypto_report_comp), &rcomp);
-
+ if (nla_put(skb, CRYPTOCFGA_REPORT_COMPRESS,
+ sizeof(struct crypto_report_comp), &rcomp))
+ goto nla_put_failure;
return 0;
nla_put_failure:
@@ -113,16 +113,16 @@ static int crypto_report_one(struct crypto_alg *alg,
ualg->cru_flags = alg->cra_flags;
ualg->cru_refcnt = atomic_read(&alg->cra_refcnt);
- NLA_PUT_U32(skb, CRYPTOCFGA_PRIORITY_VAL, alg->cra_priority);
-
+ if (nla_put_u32(skb, CRYPTOCFGA_PRIORITY_VAL, alg->cra_priority))
+ goto nla_put_failure;
if (alg->cra_flags & CRYPTO_ALG_LARVAL) {
struct crypto_report_larval rl;
snprintf(rl.type, CRYPTO_MAX_ALG_NAME, "%s", "larval");
- NLA_PUT(skb, CRYPTOCFGA_REPORT_LARVAL,
- sizeof(struct crypto_report_larval), &rl);
-
+ if (nla_put(skb, CRYPTOCFGA_REPORT_LARVAL,
+ sizeof(struct crypto_report_larval), &rl))
+ goto nla_put_failure;
goto out;
}
OpenPOWER on IntegriCloud