Thread (4 messages) 4 messages, 2 authors, 2020-10-31

[dpdk-dev] [PATCH v2] examples/fips_validation: fix checking return value

From: Ciara Power <hidden>
Date: 2020-10-30 15:37:11
Subsystem: the rest · Maintainer: Linus Torvalds

The return value was not being checked when calling the
get_writeback_data function in the AES test case. On failure, this led
to a NULL dereference when using memcpy later. The return value is now
checked to avoid this NULL dereference.

Coverity issue: 363463
Fixes: 952e10cdad5e ("examples/fips_validation: support scatter gather list")
Cc: roy.fan.zhang@intel.com

Signed-off-by: Ciara Power <redacted>

---
v2:
  - Fixed incorrect "Fixes" tag.
  - Added same fix to another test case.
---
 examples/fips_validation/main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index 07532c9562..6a1cea36f5 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -1520,7 +1520,9 @@ fips_mct_aes_test(void)
 				return ret;
 			}
 
-			get_writeback_data(&val);
+			ret = get_writeback_data(&val);
+			if (ret < 0)
+				return ret;
 
 			if (info.op == FIPS_TEST_DEC_AUTH_VERIF)
 				memcpy(prev_in, vec.ct.val, AES_BLOCK_SIZE);
@@ -1649,7 +1651,9 @@ fips_mct_sha_test(void)
 				return ret;
 			}
 
-			get_writeback_data(&val);
+			ret = get_writeback_data(&val);
+			if (ret < 0)
+				return ret;
 
 			memcpy(md[0].val, md[1].val, md[1].len);
 			md[0].len = md[1].len;
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help