DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/fips_validation: fix checking return value
@ 2020-10-28 15:38 Ciara Power
  2020-10-30 13:01 ` David Marchand
  2020-10-30 15:37 ` [dpdk-dev] [PATCH v2] " Ciara Power
  0 siblings, 2 replies; 4+ messages in thread
From: Ciara Power @ 2020-10-28 15:38 UTC (permalink / raw)
  To: dev; +Cc: Ciara Power, marko.kovacevic, roy.fan.zhang, stable

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: cd255ccf5764 ("examples/fips_validation: support AES parsing")
Cc: marko.kovacevic@intel.com
Cc: roy.fan.zhang@intel.com
Cc: stable@dpdk.org

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 examples/fips_validation/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index 07532c9562..bc7abd2b8f 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);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/fips_validation: fix checking return value
  2020-10-28 15:38 [dpdk-dev] [PATCH] examples/fips_validation: fix checking return value Ciara Power
@ 2020-10-30 13:01 ` David Marchand
  2020-10-30 15:37 ` [dpdk-dev] [PATCH v2] " Ciara Power
  1 sibling, 0 replies; 4+ messages in thread
From: David Marchand @ 2020-10-30 13:01 UTC (permalink / raw)
  To: Ciara Power; +Cc: dev, Kovacevic, Marko, Fan Zhang, dpdk stable

On Wed, Oct 28, 2020 at 4:38 PM Ciara Power <ciara.power@intel.com> wrote:
>
> 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: cd255ccf5764 ("examples/fips_validation: support AES parsing")

I'd rather flag:
Fixes: 952e10cdad5e ("examples/fips_validation: support scatter gather list")

Can you double check?


> Cc: marko.kovacevic@intel.com
> Cc: roy.fan.zhang@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> ---
>  examples/fips_validation/main.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
> index 07532c9562..bc7abd2b8f 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);

And I think we have the same issue in fips_mct_sha_test().


-- 
David Marchand


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH v2] examples/fips_validation: fix checking return value
  2020-10-28 15:38 [dpdk-dev] [PATCH] examples/fips_validation: fix checking return value Ciara Power
  2020-10-30 13:01 ` David Marchand
@ 2020-10-30 15:37 ` Ciara Power
  2020-10-31 17:09   ` David Marchand
  1 sibling, 1 reply; 4+ messages in thread
From: Ciara Power @ 2020-10-30 15:37 UTC (permalink / raw)
  To: dev; +Cc: david.marchand, Ciara Power, roy.fan.zhang, Marko Kovacevic

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 <ciara.power@intel.com>

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] examples/fips_validation: fix checking return value
  2020-10-30 15:37 ` [dpdk-dev] [PATCH v2] " Ciara Power
@ 2020-10-31 17:09   ` David Marchand
  0 siblings, 0 replies; 4+ messages in thread
From: David Marchand @ 2020-10-31 17:09 UTC (permalink / raw)
  To: Ciara Power; +Cc: dev, Fan Zhang, Marko Kovacevic

On Fri, Oct 30, 2020 at 4:37 PM Ciara Power <ciara.power@intel.com> wrote:
>
> 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")
>
> Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.

-- 
David Marchand


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-31 17:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28 15:38 [dpdk-dev] [PATCH] examples/fips_validation: fix checking return value Ciara Power
2020-10-30 13:01 ` David Marchand
2020-10-30 15:37 ` [dpdk-dev] [PATCH v2] " Ciara Power
2020-10-31 17:09   ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).