Skip to content

Commit

Permalink
mac802154: llsec: fix return value check in llsec_key_alloc()
Browse files Browse the repository at this point in the history
In case of error, the functions crypto_alloc_aead() and crypto_alloc_blkcipher()
returns ERR_PTR() and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Wei Yongjun authored and Marcel Holtmann committed Apr 30, 2015
1 parent 2b4d413 commit 89eb6d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/mac802154/llsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ llsec_key_alloc(const struct ieee802154_llsec_key *template)
for (i = 0; i < ARRAY_SIZE(key->tfm); i++) {
key->tfm[i] = crypto_alloc_aead("ccm(aes)", 0,
CRYPTO_ALG_ASYNC);
if (!key->tfm[i])
if (IS_ERR(key->tfm[i]))
goto err_tfm;
if (crypto_aead_setkey(key->tfm[i], template->key,
IEEE802154_LLSEC_KEY_SIZE))
Expand All @@ -144,7 +144,7 @@ llsec_key_alloc(const struct ieee802154_llsec_key *template)
}

key->tfm0 = crypto_alloc_blkcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC);
if (!key->tfm0)
if (IS_ERR(key->tfm0))
goto err_tfm;

if (crypto_blkcipher_setkey(key->tfm0, template->key,
Expand Down

0 comments on commit 89eb6d0

Please sign in to comment.