[PATCH 08/16] net/nfp: verify strdup return value

Chengwen Feng fengchengwen at huawei.com
Fri Nov 10 07:36:45 CET 2023


Add verify strdup return value logic.

Fixes: 3d21da66c06b ("net/nfp: create security session")
Cc: stable at dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
 drivers/net/nfp/nfp_ipsec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/nfp/nfp_ipsec.c b/drivers/net/nfp/nfp_ipsec.c
index 452947380e..7ce9cca0b2 100644
--- a/drivers/net/nfp/nfp_ipsec.c
+++ b/drivers/net/nfp/nfp_ipsec.c
@@ -524,6 +524,11 @@ nfp_aesgcm_iv_update(struct ipsec_add_sa *cfg,
 	uint8_t *cfg_iv;
 
 	iv_str = strdup(iv_string);
+	if (iv_str == NULL) {
+		PMD_DRV_LOG(ERR, "Failed to strdup iv_string");
+		return;
+	}
+
 	cfg_iv = (uint8_t *)cfg->aesgcm_fields.iv;
 
 	for (i = 0; i < iv_len; i++) {
-- 
2.17.1



More information about the dev mailing list