patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Shijith Thotton <sthotton@marvell.com>
To: <dev@dpdk.org>
Cc: <stable@dpdk.org>, Shijith Thotton <sthotton@marvell.com>,
	<jerinj@marvell.com>, <anoobj@marvell.com>,
	Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Subject: [dpdk-stable] [PATCH] test/event_crypto: fix event crypto metadata write
Date: Mon, 27 Sep 2021 20:59:13 +0530	[thread overview]
Message-ID: <fe10a92bf84637cfbc1d207b9e16657148220f1c.1632756287.git.sthotton@marvell.com> (raw)
In-Reply-To: <2c543df71bc79ff363c1aa501e0bf5a88cb448a7.1632731708.git.sthotton@marvell.com>

Using memcpy to update event crypto metadata fields (request/response)
will result in one overwriting the other. To avoid this, fields of each
structure should be updated one by one.

Fixes: 3c2c535ecfc0 ("test: add event crypto adapter auto-test")

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 app/test/test_event_crypto_adapter.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index 279aa3abf5..3d7e9fb93c 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -212,10 +212,10 @@ test_op_forward_mode(uint8_t session_less)
 
 		if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA) {
 			/* Fill in private user data information */
-			rte_memcpy(&m_data.response_info, &response_info,
-				sizeof(response_info));
-			rte_memcpy(&m_data.request_info, &request_info,
-				sizeof(request_info));
+			m_data.request_info.cdev_id = request_info.cdev_id;
+			m_data.request_info.queue_pair_id =
+				request_info.queue_pair_id;
+			m_data.response_info.event = response_info.event;
 			rte_cryptodev_sym_session_set_user_data(sess,
 						&m_data, sizeof(m_data));
 		}
@@ -231,10 +231,9 @@ test_op_forward_mode(uint8_t session_less)
 		uint32_t len = IV_OFFSET + MAXIMUM_IV_LENGTH;
 		op->private_data_offset = len;
 		/* Fill in private data information */
-		rte_memcpy(&m_data.response_info, &response_info,
-			   sizeof(response_info));
-		rte_memcpy(&m_data.request_info, &request_info,
-			   sizeof(request_info));
+		m_data.request_info.cdev_id = request_info.cdev_id;
+		m_data.request_info.queue_pair_id = request_info.queue_pair_id;
+		m_data.response_info.event = response_info.event;
 		rte_memcpy((uint8_t *)op + len, &m_data, sizeof(m_data));
 	}
 
@@ -405,8 +404,7 @@ test_op_new_mode(uint8_t session_less)
 
 		if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA) {
 			/* Fill in private user data information */
-			rte_memcpy(&m_data.response_info, &response_info,
-				   sizeof(m_data));
+			m_data.response_info.event = response_info.event;
 			rte_cryptodev_sym_session_set_user_data(sess,
 						&m_data, sizeof(m_data));
 		}
@@ -425,8 +423,7 @@ test_op_new_mode(uint8_t session_less)
 		uint32_t len = IV_OFFSET + MAXIMUM_IV_LENGTH;
 		op->private_data_offset = len;
 		/* Fill in private data information */
-		rte_memcpy(&m_data.response_info, &response_info,
-			   sizeof(m_data));
+		m_data.response_info.event = response_info.event;
 		rte_memcpy((uint8_t *)op + len, &m_data, sizeof(m_data));
 	}
 
-- 
2.25.1


       reply	other threads:[~2021-09-27 15:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2c543df71bc79ff363c1aa501e0bf5a88cb448a7.1632731708.git.sthotton@marvell.com>
2021-09-27 15:29 ` Shijith Thotton [this message]
2021-10-03  9:46   ` Gujjar, Abhinandan S
2021-10-05 15:15     ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fe10a92bf84637cfbc1d207b9e16657148220f1c.1632756287.git.sthotton@marvell.com \
    --to=sthotton@marvell.com \
    --cc=abhinandan.gujjar@intel.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).