From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id E5B9DA00C2;
	Tue, 27 Sep 2022 09:26:27 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id CDC0141133;
	Tue, 27 Sep 2022 09:26:25 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com
 [67.231.156.173])
 by mails.dpdk.org (Postfix) with ESMTP id 0EF06410D0
 for <dev@dpdk.org>; Tue, 27 Sep 2022 09:26:22 +0200 (CEST)
Received: from pps.filterd (m0045851.ppops.net [127.0.0.1])
 by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28R3hT9Y016181;
 Tue, 27 Sep 2022 00:26:22 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding : content-type; s=pfpt0220;
 bh=XyTEOB8FQ5R7RUNsCQai8pJ4eTedEqkFSEfxRW9Sxds=;
 b=eJ1lxWPCELu8fBvBn0VlBnIrE7Ew1oU7rCjBavzA+UKpirVNv8Hm2eHokbGwKdWChpgR
 phjLrCUN5OOpr4ye0It/hWRj8AfNJtgchRE5OR0Hh5QjOopBImtAxUVucynoAelFACRs
 C01eFRcX7JgTg+1j7mMnVeELuYlRcX2Jc0zrC1eMF2cVJyyNEBzq2Aili0mIMxWt9chy
 kyp68FelngkctglSrGOZ8/8xCw52QUHuDJALL3fDbSlPB3RsuBaewzunb2p29FxX4WnQ
 q+pL45E4pzfBNalOWuVtrrcUmgEUSisWEZKf9Yz2n4wCO5/yWbljTu1mIkudGlYv4V4R pA== 
Received: from dc5-exch02.marvell.com ([199.233.59.182])
 by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3jt1dp8wph-2
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Tue, 27 Sep 2022 00:26:22 -0700
Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18;
 Tue, 27 Sep 2022 00:26:20 -0700
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend
 Transport; Tue, 27 Sep 2022 00:26:20 -0700
Received: from localhost.localdomain (unknown [10.28.34.38])
 by maili.marvell.com (Postfix) with ESMTP id E8BE83F70C9;
 Tue, 27 Sep 2022 00:26:17 -0700 (PDT)
From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
To: <dev@dpdk.org>
CC: Anoob Joseph <anoobj@marvell.com>, Fan Zhang <roy.fan.zhang@intel.com>,
 Brian Dooley <brian.dooley@intel.com>,
 Akhil Goyal <gakhil@marvell.com>, <jerinj@marvell.com>,
 Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Subject: [v2 1/7] examples/fips_validation: fix parsing test group info
Date: Tue, 27 Sep 2022 12:56:06 +0530
Message-ID: <e7c9578ea6bb9d5c9fba1bb227bf0b815dd76374.1664263264.git.gmuthukrishn@marvell.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <cover.1664263264.git.gmuthukrishn@marvell.com>
References: <cover.1664263264.git.gmuthukrishn@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-ORIG-GUID: EEVK0foPN3FkkNtMI5EAW3bNQYKBRRZ5
X-Proofpoint-GUID: EEVK0foPN3FkkNtMI5EAW3bNQYKBRRZ5
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1
 definitions=2022-09-27_02,2022-09-22_02,2022-06-22_01
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

If a test group does not have expected key, it should not crash.
This patch fixes parsing test group info to continue further
when a key does not exist (as in asym tests).

Fixes: 58cc98801eb ("examples/fips_validation: add JSON parsing")

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Acked-by: Brian Dooley <brian.dooley@intel.com>
---
 examples/fips_validation/fips_validation.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c
index 6c9f5e42a4..06aeffe495 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -488,6 +488,9 @@ fips_test_parse_one_json_group(void)
 		for (i = 0; info.interim_callbacks[i].key != NULL; i++) {
 			param = json_object_get(json_info.json_test_group,
 					info.interim_callbacks[i].key);
+			if (!param)
+				continue;
+
 			switch (json_typeof(param)) {
 			case JSON_STRING:
 				snprintf(json_value, 256, "%s", json_string_value(param));
-- 
2.25.1