[04/12] examples/fips: fix bad return code in fips_test_parse_header()

Message ID 20190826094120.22590-5-michaelsh@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series FIPS improvements |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Michael Shamis Aug. 26, 2019, 9:41 a.m. UTC
  From: Michael Shamis <michaelsh@marvell.com>

Returning correct error value by fips_test_parse_header()
allows graceful exit of fips application.

Signed-off-by: Michael Shamis <michaelsh@marvell.com>
---
 examples/fips_validation/fips_validation.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Akhil Goyal Sept. 4, 2019, 9:51 a.m. UTC | #1
Hi Michael,

Title should be " examples/fips_validation: fix bad return value "

> 
> Returning correct error value by fips_test_parse_header()
> allows graceful exit of fips application.

Please add a fixes line here and cc stable.

It would be good if you can separate out the fixes from this patchset which add some functionality.

-Akhil

> 
> Signed-off-by: Michael Shamis <michaelsh@marvell.com>
> ---
>  examples/fips_validation/fips_validation.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/examples/fips_validation/fips_validation.c
> b/examples/fips_validation/fips_validation.c
> index fe3bcc386..91e6d48e7 100644
> --- a/examples/fips_validation/fips_validation.c
> +++ b/examples/fips_validation/fips_validation.c
> @@ -125,13 +125,13 @@ fips_test_parse_header(void)
>  				info.algo = FIPS_TEST_ALGO_AES_CMAC;
>  				ret = parse_test_cmac_init();
>  				if (ret < 0)
> -					return 0;
> +					return ret;
>  			} else if (strstr(info.vec[i], "CCM")) {
>  				algo_parsed = 1;
>  				info.algo = FIPS_TEST_ALGO_AES_CCM;
>  				ret = parse_test_ccm_init();
>  				if (ret < 0)
> -					return 0;
> +					return ret;
>  			} else if (strstr(info.vec[i], "HMAC")) {
>  				algo_parsed = 1;
>  				info.algo = FIPS_TEST_ALGO_HMAC;
> @@ -143,7 +143,7 @@ fips_test_parse_header(void)
>  				info.algo = FIPS_TEST_ALGO_TDES;
>  				ret = parse_test_tdes_init();
>  				if (ret < 0)
> -					return 0;
> +					return ret;
>  			} else if (strstr(info.vec[i], "SHA-")) {
>  				if (info.algo != FIPS_TEST_ALGO_HMAC) {
>  					algo_parsed = 1;
> --
> 2.23.0
  

Patch

diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c
index fe3bcc386..91e6d48e7 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -125,13 +125,13 @@  fips_test_parse_header(void)
 				info.algo = FIPS_TEST_ALGO_AES_CMAC;
 				ret = parse_test_cmac_init();
 				if (ret < 0)
-					return 0;
+					return ret;
 			} else if (strstr(info.vec[i], "CCM")) {
 				algo_parsed = 1;
 				info.algo = FIPS_TEST_ALGO_AES_CCM;
 				ret = parse_test_ccm_init();
 				if (ret < 0)
-					return 0;
+					return ret;
 			} else if (strstr(info.vec[i], "HMAC")) {
 				algo_parsed = 1;
 				info.algo = FIPS_TEST_ALGO_HMAC;
@@ -143,7 +143,7 @@  fips_test_parse_header(void)
 				info.algo = FIPS_TEST_ALGO_TDES;
 				ret = parse_test_tdes_init();
 				if (ret < 0)
-					return 0;
+					return ret;
 			} else if (strstr(info.vec[i], "SHA-")) {
 				if (info.algo != FIPS_TEST_ALGO_HMAC) {
 					algo_parsed = 1;