[PATCH] uadk: add null pointer check

5 Dec
2023
5 Dec
'23
8:49 p.m.
From: taoqi 30043660 <taoqi10@huawei.com> Whether the pointer is NULL is not checked after the memory is applied for. Signed-off-by: taoqi 30043660 <taoqi10@huawei.com> --- v1/wd_dh.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/v1/wd_dh.c b/v1/wd_dh.c index 3be6250..d574c1d 100644 --- a/v1/wd_dh.c +++ b/v1/wd_dh.c @@ -185,6 +185,10 @@ void *wcrypto_create_dh_ctx(struct wd_queue *q, struct wcrypto_dh_ctx_setup *set goto free_ctx; } ctx->g.data = ctx->setup.br.alloc(ctx->setup.br.usr, ctx->key_size); + if (!ctx->g.data) { + WD_ERR("failed to alloc ctx->g.data memory!\n"); + goto free_ctx; + } ctx->g.bsize = ctx->key_size; ret = wcrypto_init_dh_cookie(ctx); -- 2.33.0
448
Age (days ago)
448
Last active (days ago)
0 comments
1 participants
participants (1)
-
Qi Tao