Update some patch for uadk from mainline. To get more information, please visit the homepage: https://github.comp/Linaro/uadk Signed-off-by: Yang Shen <shenyang39@huawei.com>
127 lines
3.3 KiB
Diff
127 lines
3.3 KiB
Diff
From 45be6faf148734bfcfe5ea1536cae3e4a434cd84 Mon Sep 17 00:00:00 2001
|
|
From: Wenkai Lin <linwenkai6@hisilicon.com>
|
|
Date: Sat, 23 Jul 2022 16:50:25 +0800
|
|
Subject: [PATCH 158/183] uadk: fix pointer parameters are not checked
|
|
|
|
Pointer parameters of the "wd_xxx_poll" function are not checked
|
|
whether the pointer is null. Param: "count".
|
|
|
|
Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
|
|
---
|
|
wd_aead.c | 7 ++++++-
|
|
wd_cipher.c | 5 +++++
|
|
wd_dh.c | 5 +++++
|
|
wd_digest.c | 5 +++++
|
|
wd_ecc.c | 5 +++++
|
|
wd_rsa.c | 5 +++++
|
|
6 files changed, 31 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/wd_aead.c b/wd_aead.c
|
|
index d43ace1..a1bdb12 100644
|
|
--- a/wd_aead.c
|
|
+++ b/wd_aead.c
|
|
@@ -611,7 +611,7 @@ int wd_aead_poll_ctx(__u32 idx, __u32 expt, __u32 *count)
|
|
__u32 tmp = expt;
|
|
int ret;
|
|
|
|
- if (!count) {
|
|
+ if (unlikely(!count)) {
|
|
WD_ERR("invalid: aead poll ctx input param is NULL!\n");
|
|
return -WD_EINVAL;
|
|
}
|
|
@@ -658,6 +658,11 @@ int wd_aead_poll(__u32 expt, __u32 *count)
|
|
handle_t h_ctx = wd_aead_setting.sched.h_sched_ctx;
|
|
struct wd_sched *sched = &wd_aead_setting.sched;
|
|
|
|
+ if (unlikely(!count)) {
|
|
+ WD_ERR("invalid: aead poll input param is NULL!\n");
|
|
+ return -WD_EINVAL;
|
|
+ }
|
|
+
|
|
return sched->poll_policy(h_ctx, expt, count);
|
|
}
|
|
|
|
diff --git a/wd_cipher.c b/wd_cipher.c
|
|
index 3d00598..884c933 100644
|
|
--- a/wd_cipher.c
|
|
+++ b/wd_cipher.c
|
|
@@ -568,6 +568,11 @@ int wd_cipher_poll(__u32 expt, __u32 *count)
|
|
handle_t h_ctx = wd_cipher_setting.sched.h_sched_ctx;
|
|
struct wd_sched *sched = &wd_cipher_setting.sched;
|
|
|
|
+ if (unlikely(!count)) {
|
|
+ WD_ERR("invalid: cipher poll input param is NULL!\n");
|
|
+ return -WD_EINVAL;
|
|
+ }
|
|
+
|
|
return sched->poll_policy(h_ctx, expt, count);
|
|
}
|
|
|
|
diff --git a/wd_dh.c b/wd_dh.c
|
|
index 461f04e..41c4a2a 100644
|
|
--- a/wd_dh.c
|
|
+++ b/wd_dh.c
|
|
@@ -348,6 +348,11 @@ int wd_dh_poll(__u32 expt, __u32 *count)
|
|
{
|
|
handle_t h_sched_ctx = wd_dh_setting.sched.h_sched_ctx;
|
|
|
|
+ if (unlikely(!count)) {
|
|
+ WD_ERR("invalid: dh poll count is NULL!\n");
|
|
+ return -WD_EINVAL;
|
|
+ }
|
|
+
|
|
return wd_dh_setting.sched.poll_policy(h_sched_ctx, expt, count);
|
|
}
|
|
|
|
diff --git a/wd_digest.c b/wd_digest.c
|
|
index 43b4bc5..3e64168 100644
|
|
--- a/wd_digest.c
|
|
+++ b/wd_digest.c
|
|
@@ -470,6 +470,11 @@ int wd_digest_poll(__u32 expt, __u32 *count)
|
|
handle_t h_ctx = wd_digest_setting.sched.h_sched_ctx;
|
|
struct wd_sched *sched = &wd_digest_setting.sched;
|
|
|
|
+ if (unlikely(!count)) {
|
|
+ WD_ERR("invalid: digest poll input param is NULL!\n");
|
|
+ return -WD_EINVAL;
|
|
+ }
|
|
+
|
|
return sched->poll_policy(h_ctx, expt, count);
|
|
}
|
|
|
|
diff --git a/wd_ecc.c b/wd_ecc.c
|
|
index 60a320b..fed02cb 100644
|
|
--- a/wd_ecc.c
|
|
+++ b/wd_ecc.c
|
|
@@ -2176,6 +2176,11 @@ int wd_ecc_poll(__u32 expt, __u32 *count)
|
|
{
|
|
handle_t h_sched_sess = wd_ecc_setting.sched.h_sched_ctx;
|
|
|
|
+ if (unlikely(!count)) {
|
|
+ WD_ERR("invalid: ecc poll param count is NULL!\n");
|
|
+ return -WD_EINVAL;
|
|
+ }
|
|
+
|
|
return wd_ecc_setting.sched.poll_policy(h_sched_sess, expt, count);
|
|
}
|
|
|
|
diff --git a/wd_rsa.c b/wd_rsa.c
|
|
index e76da09..89d3450 100644
|
|
--- a/wd_rsa.c
|
|
+++ b/wd_rsa.c
|
|
@@ -404,6 +404,11 @@ int wd_rsa_poll(__u32 expt, __u32 *count)
|
|
{
|
|
handle_t h_sched_ctx = wd_rsa_setting.sched.h_sched_ctx;
|
|
|
|
+ if (unlikely(!count)) {
|
|
+ WD_ERR("invalid: rsa poll count is NULL!\n");
|
|
+ return -WD_EINVAL;
|
|
+ }
|
|
+
|
|
return wd_rsa_setting.sched.poll_policy(h_sched_ctx, expt, count);
|
|
}
|
|
|
|
--
|
|
2.27.0
|
|
|