diff mbox series

[v2,1/7] examples/fips_validation: fix parsing test group info

Message ID e7c9578ea6bb9d5c9fba1bb227bf0b815dd76374.1664263264.git.gmuthukrishn@marvell.com (mailing list archive)
State Accepted
Delegated to: akhil goyal
Headers show
Series FIPS asymmetric validation | expand


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

Commit Message

Gowrishankar Muthukrishnan Sept. 27, 2022, 7:26 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>
Acked-by: Brian Dooley <brian.dooley@intel.com>
 examples/fips_validation/fips_validation.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series


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,
+			if (!param)
+				continue;
 			switch (json_typeof(param)) {
 			case JSON_STRING:
 				snprintf(json_value, 256, "%s", json_string_value(param));