libwd/0095-uadk-sec-add-a-return-value-judgement.patch
2023-12-08 11:56:44 +08:00

38 lines
1.1 KiB
Diff

From f118a291c4aacebf60c3c532d004581d125df6a1 Mon Sep 17 00:00:00 2001
From: Qi Tao <taoqi10@huawei.com>
Date: Thu, 30 Nov 2023 17:14:45 +0800
Subject: [PATCH 095/114] uadk/sec: add a return value judgement
Add return value judgement of aead_get_aes_key_len().
Signed-off-by: Zhiqi Song <songzhiqi1@huawei.com>
---
drv/hisi_sec.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drv/hisi_sec.c b/drv/hisi_sec.c
index 2f03d1f..9102a27 100644
--- a/drv/hisi_sec.c
+++ b/drv/hisi_sec.c
@@ -2152,6 +2152,8 @@ static int fill_aead_bd2_alg(struct wd_aead_msg *msg,
case WD_CIPHER_AES:
sqe->type2.c_alg = C_ALG_AES;
ret = aead_get_aes_key_len(msg, &c_key_len);
+ if (ret)
+ return ret;
sqe->type2.icvw_kmode = (__u16)c_key_len << SEC_CKEY_OFFSET;
break;
default:
@@ -2721,6 +2723,8 @@ static int fill_aead_bd3_alg(struct wd_aead_msg *msg,
case WD_CIPHER_AES:
sqe->c_mode_alg |= C_ALG_AES << SEC_CALG_OFFSET_V3;
ret = aead_get_aes_key_len(msg, &c_key_len);
+ if (ret)
+ return ret;
sqe->c_icv_key |= (__u16)c_key_len << SEC_CKEY_OFFSET_V3;
break;
default:
--
2.25.1