From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2F49EA0032; Thu, 16 Dec 2021 18:54:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B535040DF7; Thu, 16 Dec 2021 18:54:41 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 2C10940696 for ; Thu, 16 Dec 2021 18:54:41 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1BGEr3uX007120 for ; Thu, 16 Dec 2021 09:54:40 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=6TvCUQD/UVMwBrzog+c4AwiZi8jvqEXrbrktGxCGY1M=; b=FLpamVlLFfGB4aQGPJUqUswpiKM+6dEIgsWj3veDPlAu/YAdGA6GiGBfvwFlBclAYGVG gvupkYweqWf+Scu/uT0AZ3k6nIkPiq/OsKAt13kWi5b54a5a+OkoXZI7u5hy264jbxow 6ZPWyIYQ4TIll4OTUP//yoxX0mXCmv6A3tMiRZFNo/tZfQlFl3WogFTL5RUMJOC9Y90P G6JQhLChlv/uUIadnKxOB31v6KH6WMTwAiP16k3AzAQUaT7b7kqJlmeY0F2u3VvNbe9T GEE/6EE6QmlCz4fNMQ5A6Z8GXJYLwisX/hVyUF/7CGMe0UTR1so9CsfSpHH1A0bfyOam hA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3d02p0af3c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 16 Dec 2021 09:54:40 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 16 Dec 2021 09:54:38 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 16 Dec 2021 09:54:38 -0800 Received: from HY-LT1002.marvell.com (HY-LT1002.marvell.com [10.28.176.218]) by maili.marvell.com (Postfix) with ESMTP id 5BA383F7048; Thu, 16 Dec 2021 09:54:36 -0800 (PST) From: Anoob Joseph To: Akhil Goyal , Jerin Jacob CC: Anoob Joseph , Archana Muniganti , Tejasree Kondoj , Subject: [PATCH v2 23/29] crypto/cnxk: fix extend tail calculation Date: Thu, 16 Dec 2021 23:19:29 +0530 Message-ID: <1639676975-1316-24-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1639676975-1316-1-git-send-email-anoobj@marvell.com> References: <1638859858-734-1-git-send-email-anoobj@marvell.com> <1639676975-1316-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: MwiTuGevRAfwp6jlertNVL5raMqi9reP X-Proofpoint-ORIG-GUID: MwiTuGevRAfwp6jlertNVL5raMqi9reP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-16_06,2021-12-16_01,2021-12-02_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org If the packet size to be incremented after IPsec processing is less than size of hdr (size incremented before submitting), then extend_tail can become negative. Allow negative values for the variable. Fixes: 67a87e89561c ("crypto/cnxk: add cn9k lookaside IPsec datapath") Cc: marchana@marvell.com Signed-off-by: Anoob Joseph --- drivers/crypto/cnxk/cn9k_ipsec_la_ops.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h b/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h index 2dc8913..2b0261e 100644 --- a/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h +++ b/drivers/crypto/cnxk/cn9k_ipsec_la_ops.h @@ -77,9 +77,10 @@ process_outb_sa(struct rte_crypto_op *cop, struct cn9k_ipsec_sa *sa, const unsigned int hdr_len = sizeof(struct roc_ie_on_outb_hdr); struct rte_crypto_sym_op *sym_op = cop->sym; struct rte_mbuf *m_src = sym_op->m_src; - uint32_t dlen, rlen, extend_tail; struct roc_ie_on_outb_sa *out_sa; struct roc_ie_on_outb_hdr *hdr; + uint32_t dlen, rlen; + int32_t extend_tail; out_sa = &sa->out_sa; @@ -88,7 +89,8 @@ process_outb_sa(struct rte_crypto_op *cop, struct cn9k_ipsec_sa *sa, extend_tail = rlen - dlen; if (unlikely(extend_tail > rte_pktmbuf_tailroom(m_src))) { - plt_dp_err("Not enough tail room"); + plt_dp_err("Not enough tail room (required: %d, available: %d", + extend_tail, rte_pktmbuf_tailroom(m_src)); return -ENOMEM; } -- 2.7.4