diff mbox series

[v1,1/5] examples/fips_validation: fix parsing test group info

Message ID 7e2bb929bdf9362fe90f0aa856057b7787a6f1f9.1660304194.git.gmuthukrishn@marvell.com (mailing list archive)
State New
Delegated to: akhil goyal
Headers show
Series FIPS asymmetric validation | expand

Checks

Context Check Description
ci/iol-testing warning apply patch failure
ci/checkpatch success coding style OK

Commit Message

Gowrishankar Muthukrishnan Aug. 12, 2022, 11:57 a.m. UTC
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>
---
 examples/fips_validation/fips_validation.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

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));