diff mbox

[1/3] validation: pktio: fix memory corruption

Message ID 1427972861-14593-1-git-send-email-stuart.haslam@linaro.org
State Accepted
Commit fbb40f45b6245ea166e50592e0d8b74554eef22a
Headers show

Commit Message

Stuart Haslam April 2, 2015, 11:07 a.m. UTC
A magic number, used to ensure jumbo frames are transmitted and received
in full, is written to the end of a packet buffer at a fixed offset of
9170 bytes. However for non-jumbo tests this is way beyond the end of
the allocated buffer.

Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
---
 test/validation/odp_pktio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Maxim Uvarov April 3, 2015, 2:40 p.m. UTC | #1
Merged this patch.

Maxim.

On 04/02/15 14:07, Stuart Haslam wrote:
> A magic number, used to ensure jumbo frames are transmitted and received
> in full, is written to the end of a packet buffer at a fixed offset of
> 9170 bytes. However for non-jumbo tests this is way beyond the end of
> the allocated buffer.
>
> Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
> ---
>   test/validation/odp_pktio.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
> index e022c33..5ea45e4 100644
> --- a/test/validation/odp_pktio.c
> +++ b/test/validation/odp_pktio.c
> @@ -95,7 +95,8 @@ static int pktio_pkt_set_seq(odp_packet_t pkt)
>   	CU_ASSERT_FATAL(data != NULL);
>   
>   	data->head.magic = TEST_SEQ_MAGIC;
> -	data->magic2 = TEST_SEQ_MAGIC;
> +	if (test_jumbo)
> +		data->magic2 = TEST_SEQ_MAGIC;
>   	data->head.seq   = tstseq;
>   
>   	odp_packet_copydata_in(pkt, l4_off+ODPH_UDPHDR_LEN,
diff mbox

Patch

diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
index e022c33..5ea45e4 100644
--- a/test/validation/odp_pktio.c
+++ b/test/validation/odp_pktio.c
@@ -95,7 +95,8 @@  static int pktio_pkt_set_seq(odp_packet_t pkt)
 	CU_ASSERT_FATAL(data != NULL);
 
 	data->head.magic = TEST_SEQ_MAGIC;
-	data->magic2 = TEST_SEQ_MAGIC;
+	if (test_jumbo)
+		data->magic2 = TEST_SEQ_MAGIC;
 	data->head.seq   = tstseq;
 
 	odp_packet_copydata_in(pkt, l4_off+ODPH_UDPHDR_LEN,