test/crypto: add null check for ZUC authentication op

Message ID 20220511132924.1163284-1-ciara.power@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series test/crypto: add null check for ZUC authentication op |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS

Commit Message

Power, Ciara May 11, 2022, 1:29 p.m. UTC
  Check if the returned op is NULL because of failure,
before using it and causing a segmentation fault.

Fixes: 4c99481 ("app/test: add ZUC")
Cc: pablo.de.lara.guarch@intel.com
Cc: stable@dpdk.org

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 app/test/test_cryptodev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

De Lara Guarch, Pablo May 11, 2022, 2:25 p.m. UTC | #1
> -----Original Message-----
> From: Power, Ciara <ciara.power@intel.com>
> Sent: Wednesday, May 11, 2022 2:29 PM
> To: dev@dpdk.org
> Cc: Zhang, Roy Fan <roy.fan.zhang@intel.com>; Ji, Kai <kai.ji@intel.com>;
> Power, Ciara <ciara.power@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; stable@dpdk.org; Akhil Goyal
> <gakhil@marvell.com>
> Subject: [PATCH] test/crypto: add null check for ZUC authentication op
> 
> Check if the returned op is NULL because of failure, before using it and causing a
> segmentation fault.
> 
> Fixes: 4c99481 ("app/test: add ZUC")
> Cc: pablo.de.lara.guarch@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ciara Power <ciara.power@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
  
Akhil Goyal May 11, 2022, 8 p.m. UTC | #2
> > Subject: [PATCH] test/crypto: add null check for ZUC authentication op
> >
> > Check if the returned op is NULL because of failure, before using it and causing
> a
> > segmentation fault.
> >
> > Fixes: 4c99481 ("app/test: add ZUC")
> > Cc: pablo.de.lara.guarch@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Ciara Power <ciara.power@intel.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Applied to dpdk-next-crypto

Changed subject
test/crypto: fix null check for ZUC authentication op
  

Patch

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index f444144cc6..4ffaadc008 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -6238,8 +6238,8 @@  test_zuc_authentication(const struct wireless_test_data *tdata)
 	else
 		ut_params->op = process_crypto_request(ts_params->valid_devs[0],
 				ut_params->op);
-	ut_params->obuf = ut_params->op->sym->m_src;
 	TEST_ASSERT_NOT_NULL(ut_params->op, "failed to retrieve obuf");
+	ut_params->obuf = ut_params->op->sym->m_src;
 	ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *)
 			+ plaintext_pad_len;