crypto/cnxk: fix RISC-V compilation

Message ID 20231011071825.3416866-1-ktejasree@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series crypto/cnxk: fix RISC-V compilation |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-testing warning apply patch failure

Commit Message

Tejasree Kondoj Oct. 11, 2023, 7:18 a.m. UTC
  Fixing RISC-V compilation failure by adding check
for NULL pointer.

Fixes: 905537accdd1 ("crypto/cnxk: support raw APIs")

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---
 drivers/crypto/cnxk/cnxk_se.h | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Thomas Monjalon Oct. 11, 2023, 8:03 a.m. UTC | #1
11/10/2023 09:18, Tejasree Kondoj:
> Fixing RISC-V compilation failure by adding check
> for NULL pointer.
> 
> Fixes: 905537accdd1 ("crypto/cnxk: support raw APIs")
> 
> Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>

Squashed in "crypto/cnxk: support raw APIs", thank you.
  

Patch

diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h
index 5d138163f0..c2a807fa94 100644
--- a/drivers/crypto/cnxk/cnxk_se.h
+++ b/drivers/crypto/cnxk/cnxk_se.h
@@ -1834,6 +1834,10 @@  cpt_kasumi_enc_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens,
 	cpt_inst_w4.s.param2 = auth_data_len;
 
 	inst->w4.u64 = cpt_inst_w4.u64;
+
+	if (unlikely(iv_s == NULL))
+		return -1;
+
 	if (is_sg_ver2)
 		sg2_inst_prep(params, inst, offset_ctrl, iv_s, iv_len, 0, 0, inputlen, outputlen, 0,
 			      req_flags, 0, 0);
@@ -1890,6 +1894,10 @@  cpt_kasumi_dec_prep(uint64_t d_offs, uint64_t d_lens, struct roc_se_fc_params *p
 	}
 
 	inst->w4.u64 = cpt_inst_w4.u64;
+
+	if (unlikely(params->iv_buf == NULL))
+		return -1;
+
 	if (is_sg_ver2)
 		sg2_inst_prep(params, inst, offset_ctrl, params->iv_buf, iv_len, 0, 0, inputlen,
 			      outputlen, 0, 0, 0, 1);