Skip to content

Commit 89eb6d0

Browse files
Wei Yongjunholtmann
authored andcommitted
mac802154: llsec: fix return value check in llsec_key_alloc()
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 <[email protected]> Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 2b4d413 commit 89eb6d0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/mac802154/llsec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ llsec_key_alloc(const struct ieee802154_llsec_key *template)
134134
for (i = 0; i < ARRAY_SIZE(key->tfm); i++) {
135135
key->tfm[i] = crypto_alloc_aead("ccm(aes)", 0,
136136
CRYPTO_ALG_ASYNC);
137-
if (!key->tfm[i])
137+
if (IS_ERR(key->tfm[i]))
138138
goto err_tfm;
139139
if (crypto_aead_setkey(key->tfm[i], template->key,
140140
IEEE802154_LLSEC_KEY_SIZE))
@@ -144,7 +144,7 @@ llsec_key_alloc(const struct ieee802154_llsec_key *template)
144144
}
145145

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

150150
if (crypto_blkcipher_setkey(key->tfm0, template->key,

0 commit comments

Comments
 (0)