diff options
| -rw-r--r-- | crypto/api.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crypto/api.c b/crypto/api.c index 2d8d828c0ca2..b4728811ce3b 100644 --- a/crypto/api.c +++ b/crypto/api.c | |||
| @@ -13,6 +13,8 @@ | |||
| 13 | * any later version. | 13 | * any later version. |
| 14 | * | 14 | * |
| 15 | */ | 15 | */ |
| 16 | |||
| 17 | #include <linux/compiler.h> | ||
| 16 | #include <linux/init.h> | 18 | #include <linux/init.h> |
| 17 | #include <linux/crypto.h> | 19 | #include <linux/crypto.h> |
| 18 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
| @@ -189,8 +191,14 @@ out: | |||
| 189 | 191 | ||
| 190 | void crypto_free_tfm(struct crypto_tfm *tfm) | 192 | void crypto_free_tfm(struct crypto_tfm *tfm) |
| 191 | { | 193 | { |
| 192 | struct crypto_alg *alg = tfm->__crt_alg; | 194 | struct crypto_alg *alg; |
| 193 | int size = sizeof(*tfm) + alg->cra_ctxsize; | 195 | int size; |
| 196 | |||
| 197 | if (unlikely(!tfm)) | ||
| 198 | return; | ||
| 199 | |||
| 200 | alg = tfm->__crt_alg; | ||
| 201 | size = sizeof(*tfm) + alg->cra_ctxsize; | ||
| 194 | 202 | ||
| 195 | crypto_exit_ops(tfm); | 203 | crypto_exit_ops(tfm); |
| 196 | crypto_alg_put(alg); | 204 | crypto_alg_put(alg); |
