patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] examples/fips_validation: fix coverity issues
@ 2024-06-15 11:31 Gowrishankar Muthukrishnan
  2024-06-17 17:49 ` Patrick Robb
  2024-06-20 16:33 ` Dooley, Brian
  0 siblings, 2 replies; 4+ messages in thread
From: Gowrishankar Muthukrishnan @ 2024-06-15 11:31 UTC (permalink / raw)
  To: dev, Brian Dooley, Gowrishankar Muthukrishnan; +Cc: Anoob Joseph, stable

Fix NULL dereference, out-of-bound, bad bit shift issues
reported by coverity scan.

Coverity issue: 384440, 384435, 384433, 384429
Fixes: 36128a67c27 ("examples/fips_validation: add asymmetric validation")
Cc: stable@dpdk.org

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 examples/fips_validation/fips_validation_rsa.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/examples/fips_validation/fips_validation_rsa.c b/examples/fips_validation/fips_validation_rsa.c
index f675b51051..55f81860a0 100644
--- a/examples/fips_validation/fips_validation_rsa.c
+++ b/examples/fips_validation/fips_validation_rsa.c
@@ -328,6 +328,9 @@ parse_test_rsa_json_interim_writeback(struct fips_val *val)
 		if (prepare_vec_rsa() < 0)
 			return -1;
 
+		if (!vec.rsa.e.val)
+			return -1;
+
 		writeback_hex_str("", info.one_line_text, &vec.rsa.n);
 		obj = json_string(info.one_line_text);
 		json_object_set_new(json_info.json_write_group, "n", obj);
@@ -474,7 +477,7 @@ fips_test_randomize_message(struct fips_val *msg, struct fips_val *rand)
 	uint16_t rv_len;
 
 	if (!msg->val || !rand->val || rand->len > RV_BUF_LEN
-		|| msg->len > FIPS_TEST_JSON_BUF_LEN)
+		|| msg->len > (FIPS_TEST_JSON_BUF_LEN - 1))
 		return -EINVAL;
 
 	memset(rv, 0, sizeof(rv));
@@ -503,7 +506,7 @@ fips_test_randomize_message(struct fips_val *msg, struct fips_val *rand)
 		m[i + j] ^= rv[j];
 
 	m[i + j] = ((uint8_t *)&rv_bitlen)[0];
-	m[i + j + 1] = (((uint8_t *)&rv_bitlen)[1] >> 8) & 0xFF;
+	m[i + j + 1] = ((uint8_t *)&rv_bitlen)[1];
 
 	rte_free(msg->val);
 	msg->len = (rv_bitlen + m_bitlen + 16) / 8;
-- 
2.25.1


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

* Re: [PATCH] examples/fips_validation: fix coverity issues
  2024-06-15 11:31 [PATCH] examples/fips_validation: fix coverity issues Gowrishankar Muthukrishnan
@ 2024-06-17 17:49 ` Patrick Robb
  2024-06-20 16:33 ` Dooley, Brian
  1 sibling, 0 replies; 4+ messages in thread
From: Patrick Robb @ 2024-06-17 17:49 UTC (permalink / raw)
  To: Gowrishankar Muthukrishnan
  Cc: dev, Brian Dooley, Anoob Joseph, stable, Maxime Coquelin

For CI Testing: re-applying to main and retesting because main was in
a bad state (now fixed by Maxime), causing a virtio_smoke fail on this
series.

https://git.dpdk.org/dpdk/commit/?id=6bdc14606724bc7fb3834d5ec59b1cccf98adf28

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

* RE: [PATCH] examples/fips_validation: fix coverity issues
  2024-06-15 11:31 [PATCH] examples/fips_validation: fix coverity issues Gowrishankar Muthukrishnan
  2024-06-17 17:49 ` Patrick Robb
@ 2024-06-20 16:33 ` Dooley, Brian
  2024-07-02 15:44   ` Akhil Goyal
  1 sibling, 1 reply; 4+ messages in thread
From: Dooley, Brian @ 2024-06-20 16:33 UTC (permalink / raw)
  To: Gowrishankar Muthukrishnan, dev; +Cc: Anoob Joseph, stable

Hey Gowrishankar,

> -----Original Message-----
> From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
> Sent: Saturday, June 15, 2024 12:31 PM
> To: dev@dpdk.org; Dooley, Brian <brian.dooley@intel.com>; Gowrishankar
> Muthukrishnan <gmuthukrishn@marvell.com>
> Cc: Anoob Joseph <anoobj@marvell.com>; stable@dpdk.org
> Subject: [PATCH] examples/fips_validation: fix coverity issues
> 
> Fix NULL dereference, out-of-bound, bad bit shift issues reported by coverity
> scan.
> 
> Coverity issue: 384440, 384435, 384433, 384429
> Fixes: 36128a67c27 ("examples/fips_validation: add asymmetric validation")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
> ---
>  examples/fips_validation/fips_validation_rsa.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/fips_validation/fips_validation_rsa.c
> b/examples/fips_validation/fips_validation_rsa.c
> index f675b51051..55f81860a0 100644
> --- a/examples/fips_validation/fips_validation_rsa.c
> +++ b/examples/fips_validation/fips_validation_rsa.c
> @@ -328,6 +328,9 @@ parse_test_rsa_json_interim_writeback(struct
> fips_val *val)
>  		if (prepare_vec_rsa() < 0)
>  			return -1;
> 
> +		if (!vec.rsa.e.val)
> +			return -1;
> +
>  		writeback_hex_str("", info.one_line_text, &vec.rsa.n);
>  		obj = json_string(info.one_line_text);
>  		json_object_set_new(json_info.json_write_group, "n", obj);
> @@ -474,7 +477,7 @@ fips_test_randomize_message(struct fips_val *msg,
> struct fips_val *rand)
>  	uint16_t rv_len;
> 
>  	if (!msg->val || !rand->val || rand->len > RV_BUF_LEN
> -		|| msg->len > FIPS_TEST_JSON_BUF_LEN)
> +		|| msg->len > (FIPS_TEST_JSON_BUF_LEN - 1))
>  		return -EINVAL;
> 
>  	memset(rv, 0, sizeof(rv));
> @@ -503,7 +506,7 @@ fips_test_randomize_message(struct fips_val *msg,
> struct fips_val *rand)
>  		m[i + j] ^= rv[j];
> 
>  	m[i + j] = ((uint8_t *)&rv_bitlen)[0];
> -	m[i + j + 1] = (((uint8_t *)&rv_bitlen)[1] >> 8) & 0xFF;
> +	m[i + j + 1] = ((uint8_t *)&rv_bitlen)[1];
> 
>  	rte_free(msg->val);
>  	msg->len = (rv_bitlen + m_bitlen + 16) / 8;
> --
> 2.25.1

Acked-by: Brian Dooley <brian.dooley@intel.com>


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

* RE: [PATCH] examples/fips_validation: fix coverity issues
  2024-06-20 16:33 ` Dooley, Brian
@ 2024-07-02 15:44   ` Akhil Goyal
  0 siblings, 0 replies; 4+ messages in thread
From: Akhil Goyal @ 2024-07-02 15:44 UTC (permalink / raw)
  To: Dooley, Brian, Gowrishankar Muthukrishnan, dev; +Cc: Anoob Joseph, stable

> Hey Gowrishankar,
> 
> > -----Original Message-----
> > From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
> > Sent: Saturday, June 15, 2024 12:31 PM
> > To: dev@dpdk.org; Dooley, Brian <brian.dooley@intel.com>; Gowrishankar
> > Muthukrishnan <gmuthukrishn@marvell.com>
> > Cc: Anoob Joseph <anoobj@marvell.com>; stable@dpdk.org
> > Subject: [PATCH] examples/fips_validation: fix coverity issues
> >
> > Fix NULL dereference, out-of-bound, bad bit shift issues reported by coverity
> > scan.
> >
> > Coverity issue: 384440, 384435, 384433, 384429
> > Fixes: 36128a67c27 ("examples/fips_validation: add asymmetric validation")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
> 
> Acked-by: Brian Dooley <brian.dooley@intel.com>
Applied to dpdk-next-crypto
Title updated as "examples/fips_validation: fix null dereference and out-of-bound"

Thanks.

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

end of thread, other threads:[~2024-07-02 15:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-15 11:31 [PATCH] examples/fips_validation: fix coverity issues Gowrishankar Muthukrishnan
2024-06-17 17:49 ` Patrick Robb
2024-06-20 16:33 ` Dooley, Brian
2024-07-02 15:44   ` Akhil Goyal

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