mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-28 16:14:20 +08:00
[bsp]Fixed a stack overflow bug in drv_crypto.c
Added if null before used.
This commit is contained in:
@@ -168,6 +168,11 @@ static rt_err_t _crypto_create(struct rt_hwcrypto_ctx *ctx)
|
|||||||
case HWCRYPTO_TYPE_RNG:
|
case HWCRYPTO_TYPE_RNG:
|
||||||
{
|
{
|
||||||
RNG_HandleTypeDef *hrng = rt_calloc(1, sizeof(RNG_HandleTypeDef));
|
RNG_HandleTypeDef *hrng = rt_calloc(1, sizeof(RNG_HandleTypeDef));
|
||||||
|
if (RT_NULL == hrng)
|
||||||
|
{
|
||||||
|
res = -RT_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
hrng->Instance = RNG;
|
hrng->Instance = RNG;
|
||||||
HAL_RNG_Init(hrng);
|
HAL_RNG_Init(hrng);
|
||||||
|
|||||||
Reference in New Issue
Block a user