summaryrefslogtreecommitdiff
path: root/bsp/stm32/libraries
diff options
context:
space:
mode:
authorDavid Lin <[email protected]>2020-03-14 23:11:37 +0800
committerGitHub <[email protected]>2020-03-14 23:11:37 +0800
commit45ae555a0bd45e4ebbbdb6774f5757664ac1fafd (patch)
treeeb1829a07e3e0ab276666d6158caf4cf4633611d /bsp/stm32/libraries
parent891e4794c09d7701c9ab685aaa6442689ddcbb54 (diff)
[bsp]Fixed a stack overflow bug in drv_crypto.c
Added if null before used.
Diffstat (limited to 'bsp/stm32/libraries')
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/drv_crypto.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_crypto.c b/bsp/stm32/libraries/HAL_Drivers/drv_crypto.c
index 85d8f1b1b7..795d3b499c 100644
--- a/bsp/stm32/libraries/HAL_Drivers/drv_crypto.c
+++ b/bsp/stm32/libraries/HAL_Drivers/drv_crypto.c
@@ -168,6 +168,11 @@ static rt_err_t _crypto_create(struct rt_hwcrypto_ctx *ctx)
case HWCRYPTO_TYPE_RNG:
{
RNG_HandleTypeDef *hrng = rt_calloc(1, sizeof(RNG_HandleTypeDef));
+ if (RT_NULL == hrng)
+ {
+ res = -RT_ERROR;
+ break;
+ }
hrng->Instance = RNG;
HAL_RNG_Init(hrng);