From 5a1b1dd52ce7cf0e5aaf40781d2b3820ca615834 Mon Sep 17 00:00:00 2001 From: Qi Tao Date: Thu, 30 Nov 2023 17:02:26 +0800 Subject: [PATCH 100/123] uadk: fixed some input parameter checking issues Inside the asynchronous packet receiving interface of all submodules. When the number of expected received packets is 0. Failure to intercept will result in abnormal packet recycling. As a result, the number of normal service packets does not match. In addition, when the expected value is 0, it will cause the while loop control adjustment to flip, resulting in other receiving operations. Signed-off-by: Longfang Liu --- wd_aead.c | 2 +- wd_cipher.c | 2 +- wd_comp.c | 4 ++-- wd_dh.c | 4 ++-- wd_digest.c | 2 +- wd_ecc.c | 4 ++-- wd_rsa.c | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/wd_aead.c b/wd_aead.c index 20d1109..9b23411 100644 --- a/wd_aead.c +++ b/wd_aead.c @@ -813,7 +813,7 @@ int wd_aead_poll_ctx(__u32 idx, __u32 expt, __u32 *count) __u32 tmp = expt; int ret; - if (unlikely(!count)) { + if (unlikely(!count || !expt)) { WD_ERR("invalid: aead poll ctx input param is NULL!\n"); return -WD_EINVAL; } diff --git a/wd_cipher.c b/wd_cipher.c index 76b9bad..029c854 100644 --- a/wd_cipher.c +++ b/wd_cipher.c @@ -732,7 +732,7 @@ int wd_cipher_poll_ctx(__u32 idx, __u32 expt, __u32 *count) __u32 tmp = expt; int ret; - if (unlikely(!count)) { + if (unlikely(!count || !expt)) { WD_ERR("invalid: cipher poll ctx input param is NULL!\n"); return -WD_EINVAL; } diff --git a/wd_comp.c b/wd_comp.c index b6fe85c..c2e393d 100644 --- a/wd_comp.c +++ b/wd_comp.c @@ -342,8 +342,8 @@ int wd_comp_poll_ctx(__u32 idx, __u32 expt, __u32 *count) __u32 tmp = expt; int ret; - if (unlikely(!count)) { - WD_ERR("invalid: comp poll count is 0!\n"); + if (unlikely(!count || !expt)) { + WD_ERR("invalid: comp poll count or expt is 0!\n"); return -WD_EINVAL; } diff --git a/wd_dh.c b/wd_dh.c index 157f7c6..6bfc0cc 100644 --- a/wd_dh.c +++ b/wd_dh.c @@ -446,8 +446,8 @@ int wd_dh_poll_ctx(__u32 idx, __u32 expt, __u32 *count) __u32 tmp = expt; int ret; - if (unlikely(!count)) { - WD_ERR("invalid: count is NULL!\n"); + if (unlikely(!count || !expt)) { + WD_ERR("invalid: dh poll count or expt is NULL!\n"); return -WD_EINVAL; } diff --git a/wd_digest.c b/wd_digest.c index 3cbb828..7e09d96 100644 --- a/wd_digest.c +++ b/wd_digest.c @@ -698,7 +698,7 @@ int wd_digest_poll_ctx(__u32 idx, __u32 expt, __u32 *count) __u32 tmp = expt; int ret; - if (unlikely(!count)) { + if (unlikely(!count || !expt)) { WD_ERR("invalid: digest poll ctx input param is NULL!\n"); return -WD_EINVAL; } diff --git a/wd_ecc.c b/wd_ecc.c index a1d4dae..3cdbfdf 100644 --- a/wd_ecc.c +++ b/wd_ecc.c @@ -2280,8 +2280,8 @@ int wd_ecc_poll_ctx(__u32 idx, __u32 expt, __u32 *count) __u32 tmp = expt; int ret; - if (unlikely(!count)) { - WD_ERR("invalid: param count is NULL!\n"); + if (unlikely(!count || !expt)) { + WD_ERR("invalid: ecc poll param count or expt is NULL!\n"); return -WD_EINVAL; } diff --git a/wd_rsa.c b/wd_rsa.c index b986855..1424f61 100644 --- a/wd_rsa.c +++ b/wd_rsa.c @@ -503,8 +503,8 @@ int wd_rsa_poll_ctx(__u32 idx, __u32 expt, __u32 *count) __u32 tmp = expt; int ret; - if (unlikely(!count)) { - WD_ERR("invalid: param count is NULL!\n"); + if (unlikely(!count || !expt)) { + WD_ERR("invalid: rsa poll count or expt is NULL!\n"); return -WD_EINVAL; } -- 2.31.1.windows.1