From patchwork Thu Aug 4 13:40:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Prakash Shukla X-Patchwork-Id: 114614 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 93834A00C4; Thu, 4 Aug 2022 15:41:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 852F442BEA; Thu, 4 Aug 2022 15:41:19 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id C2F994282B; Thu, 4 Aug 2022 15:41:17 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 274DK71P022469; Thu, 4 Aug 2022 06:41:17 -0700 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=UullidxIjy/AVCVS1zpq4fmnOFwE2VcR89Beg8QUxoU=; b=MmfPZNwTMtbls5Y8ou6lPzV82eh9pGzmfbf88ty0r8uJjXLwM149GS2QmCLGw+m08t6i LTLOp60flhplqBZEpZuGhv2FSkbSfKhADx+ki1P0O+HWZSCiBCpceqS+tbGVF0DwknXT iO9W7WrxGY5KikLxn+O8/G2gloA37VhDzhzcUZL7gRlM57wz4m5CL1ASRqfQcWVewVOS I9dJKesDmZuD2NNAGf/YwLVaXTkvrVeHahLN9C7EkB/PNdiSNj/tm9/YtDnh4syy18Di 7ps5NdoqVMQbYzA/iBTMw8eZp7i79GYx8SUCPCwQ/QlQM3F+jaUUaUGK/jCJGjaT8RdS 3w== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3hqgf1xqh9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 04 Aug 2022 06:41:17 -0700 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, 4 Aug 2022 06:41:15 -0700 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, 4 Aug 2022 06:41:14 -0700 Received: from localhost.localdomain (unknown [10.28.36.157]) by maili.marvell.com (Postfix) with ESMTP id C7E163F7057; Thu, 4 Aug 2022 06:41:12 -0700 (PDT) From: Amit Prakash Shukla To: Konstantin Ananyev , Bernard Iremonger , Vladimir Medvedkin CC: , , Amit Prakash Shukla , Subject: [PATCH 2/3] ipsec: compilation fix for GCC-12 Date: Thu, 4 Aug 2022 19:10:54 +0530 Message-ID: <20220804134055.1816993-2-amitprakashs@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804134055.1816993-1-amitprakashs@marvell.com> References: <20220804134055.1816993-1-amitprakashs@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: pMwJubZvoayWuHMt0jMlkIr2V0uUliTe X-Proofpoint-ORIG-GUID: pMwJubZvoayWuHMt0jMlkIr2V0uUliTe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-04_03,2022-08-04_02,2022-06-22_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 GCC 12 raises the following warning: In file included from ../lib/eal/x86/include/rte_atomic.h:15, from ../lib/eal/include/generic/rte_pause.h:19, from ../lib/eal/x86/include/rte_pause.h:12, from ../lib/eal/include/generic/rte_spinlock.h:25, from ../lib/eal/x86/include/rte_spinlock.h:12, from ../lib/mempool/rte_mempool.h:43, from ../lib/mbuf/rte_mbuf.h:38, from ../lib/cryptodev/rte_crypto.h:20, from ../lib/cryptodev/rte_cryptodev.h:22, from ../lib/ipsec/rte_ipsec_sa.h:15, from ../lib/ipsec/rte_ipsec.h:17, from ../lib/ipsec/esp_outb.c:5: In function '_mm_loadu_si128', inlined from 'rte_mov16' at ../lib/eal/x86/include/rte_memcpy.h:507:9, inlined from 'rte_mov128' at ../lib/eal/x86/include/rte_memcpy.h:549:2, inlined from 'rte_memcpy_generic' at ../lib/eal/x86/include/rte_memcpy.h:732:4, inlined from 'rte_memcpy' at ../lib/eal/x86/include/rte_memcpy.h:882:10, inlined from 'outb_tun_pkt_prepare' at ../lib/ipsec/esp_outb.c:224:2: /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/emmintrin.h:703:10: error: array subscript '__m128i_u[15]' is partly outside array bounds of 'const uint8_t[255]' {aka 'const unsigned char[255]'} [-Werror=array-bounds] 703 | return *__P; | ^~~~ In file included from ../lib/ipsec/esp_outb.c:17: ../lib/ipsec/pad.h: In function 'outb_tun_pkt_prepare': ../lib/ipsec/pad.h:10:22: note: at offset 240 into object 'esp_pad_bytes' of size 255 10 | static const uint8_t esp_pad_bytes[IPSEC_MAX_PAD_SIZE] = { | ^~~~~~~~~~~~~ In function '_mm_loadu_si128', inlined from 'rte_mov16' at ../lib/eal/x86/include/rte_memcpy.h:507:9, inlined from 'rte_mov128' at ../lib/eal/x86/include/rte_memcpy.h:549:2, inlined from 'rte_memcpy_generic' at ../lib/eal/x86/include/rte_memcpy.h:732:4, inlined from 'rte_memcpy' at ../lib/eal/x86/include/rte_memcpy.h:882:10, inlined from 'outb_trs_pkt_prepare' at ../lib/ipsec/esp_outb.c:421:2: /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/emmintrin.h:703:10: error: array subscript '__m128i_u[15]' is partly outside array bounds of 'const uint8_t[255]' {aka 'const unsigned char[255]'} [-Werror=array-bounds] 703 | return *__P; | ^~~~ ../lib/ipsec/pad.h: In function 'outb_trs_pkt_prepare': ../lib/ipsec/pad.h:10:22: note: at offset 240 into object 'esp_pad_bytes' of size 255 10 | static const uint8_t esp_pad_bytes[IPSEC_MAX_PAD_SIZE] = { | ^~~~~~~~~~~~~ Restrict copy to minimum size. Bugzilla ID: 1060 Fixes: 6015e6a13398 ("ipsec: move inbound and outbound code") Cc: stable@dpdk.org Signed-off-by: Amit Prakash Shukla Acked-by: Konstantin Ananyev --- lib/ipsec/esp_outb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ipsec/esp_outb.c b/lib/ipsec/esp_outb.c index 672e56aba0..aa18c89468 100644 --- a/lib/ipsec/esp_outb.c +++ b/lib/ipsec/esp_outb.c @@ -220,8 +220,10 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, /* pad length */ pdlen -= sizeof(*espt); + RTE_ASSERT(pdlen <= sizeof(esp_pad_bytes)); + /* copy padding data */ - rte_memcpy(pt, esp_pad_bytes, pdlen); + rte_memcpy(pt, esp_pad_bytes, RTE_MIN(pdlen, sizeof(esp_pad_bytes))); /* update esp trailer */ espt = (struct rte_esp_tail *)(pt + pdlen); @@ -417,8 +419,10 @@ outb_trs_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, /* pad length */ pdlen -= sizeof(*espt); + RTE_ASSERT(pdlen <= sizeof(esp_pad_bytes)); + /* copy padding data */ - rte_memcpy(pt, esp_pad_bytes, pdlen); + rte_memcpy(pt, esp_pad_bytes, RTE_MIN(pdlen, sizeof(esp_pad_bytes))); /* update esp trailer */ espt = (struct rte_esp_tail *)(pt + pdlen);