[PATCH 11/14] common/cpt: use rte_pktmbuf_mtod_offset

Stephen Hemminger stephen at networkplumber.org
Fri May 5 19:48:10 CEST 2023


Autogenerated with cocci/mtod-offset.cocci

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/common/cpt/cpt_ucode.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/common/cpt/cpt_ucode.h b/drivers/common/cpt/cpt_ucode.h
index b393be4cf661..87a3ac80b9da 100644
--- a/drivers/common/cpt/cpt_ucode.h
+++ b/drivers/common/cpt/cpt_ucode.h
@@ -3167,9 +3167,8 @@ fill_fc_params(struct rte_crypto_op *cop,
 				m = m_src;
 
 			/* hmac immediately following data is best case */
-			if (unlikely(rte_pktmbuf_mtod(m, uint8_t *) +
-			    mc_hash_off !=
-			    (uint8_t *)sym_op->aead.digest.data)) {
+			if (unlikely(rte_pktmbuf_mtod_offset(m, uint8_t *, mc_hash_off) !=
+				     (uint8_t *)sym_op->aead.digest.data)) {
 				flags |= VALID_MAC_BUF;
 				fc_params.mac_buf.size = sess_misc->mac_len;
 				fc_params.mac_buf.vaddr =
@@ -3211,9 +3210,8 @@ fill_fc_params(struct rte_crypto_op *cop,
 
 			/* hmac immediately following data is best case */
 			if (!ctx->dec_auth && !ctx->auth_enc &&
-				 (unlikely(rte_pktmbuf_mtod(m, uint8_t *) +
-			    mc_hash_off !=
-			     (uint8_t *)sym_op->auth.digest.data))) {
+				 (unlikely(rte_pktmbuf_mtod_offset(m, uint8_t *, mc_hash_off) !=
+					   (uint8_t *)sym_op->auth.digest.data))) {
 				flags |= VALID_MAC_BUF;
 				fc_params.mac_buf.size =
 					sess_misc->mac_len;
-- 
2.39.2



More information about the dev mailing list