[1/3] crypto/octeontx2: fix member overlap

Message ID 1626172028-100-1-git-send-email-anoobj@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series [1/3] crypto/octeontx2: fix member overlap |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Anoob Joseph July 13, 2021, 10:27 a.m. UTC
  The member 'dir' should not overlap with 'ip'. Usage of union for all
members would mean dir would get corrupt.

Fixes: e91b4f45ff54 ("net/octeontx2: support anti-replay for security session")
Cc: adwivedi@marvell.com

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
---
 drivers/crypto/octeontx2/otx2_security.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
  

Comments

Akhil Goyal July 18, 2021, 8:33 a.m. UTC | #1
> The member 'dir' should not overlap with 'ip'. Usage of union for all
> members would mean dir would get corrupt.
> 
> Fixes: e91b4f45ff54 ("net/octeontx2: support anti-replay for security
> session")
> Cc: adwivedi@marvell.com
> 
> Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Cc: stable@dpdk.org

Series
Acked-by: Akhil Goyal <gakhil@marvell.com>

Applied to dpdk-next-crypto

Thanks.
  

Patch

diff --git a/drivers/crypto/octeontx2/otx2_security.h b/drivers/crypto/octeontx2/otx2_security.h
index 9f1ba71..29c8fc3 100644
--- a/drivers/crypto/octeontx2/otx2_security.h
+++ b/drivers/crypto/octeontx2/otx2_security.h
@@ -20,14 +20,16 @@ 
 #define OTX2_SEC_AES_GCM_ROUNDUP_BYTE_LEN	4
 #define OTX2_SEC_AES_CBC_ROUNDUP_BYTE_LEN	16
 
-union otx2_sec_session_ipsec {
-	struct otx2_sec_session_ipsec_ip ip;
-	struct otx2_sec_session_ipsec_lp lp;
+struct otx2_sec_session_ipsec {
+	union {
+		struct otx2_sec_session_ipsec_ip ip;
+		struct otx2_sec_session_ipsec_lp lp;
+	};
 	enum rte_security_ipsec_sa_direction dir;
 };
 
 struct otx2_sec_session {
-	union otx2_sec_session_ipsec ipsec;
+	struct otx2_sec_session_ipsec ipsec;
 	void *userdata;
 	/**< Userdata registered by the application */
 } __rte_cache_aligned;