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 40359A0540 for ; Sun, 7 Aug 2022 15:17:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 33773410D1; Sun, 7 Aug 2022 15:17:43 +0200 (CEST) Received: from forward500p.mail.yandex.net (forward500p.mail.yandex.net [77.88.28.110]) by mails.dpdk.org (Postfix) with ESMTP id 8AD354014F; Sun, 7 Aug 2022 15:17:40 +0200 (CEST) Received: from sas1-384d3eaa6677.qloud-c.yandex.net (sas1-384d3eaa6677.qloud-c.yandex.net [IPv6:2a02:6b8:c14:3a29:0:640:384d:3eaa]) by forward500p.mail.yandex.net (Yandex) with ESMTP id ECCC3F013AC; Sun, 7 Aug 2022 16:17:39 +0300 (MSK) Received: by sas1-384d3eaa6677.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id X6CO5W9w8z-HchWPrdF; Sun, 07 Aug 2022 16:17:39 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1659878259; bh=bHExn6jpb5fVjHZzv10K9pzQ+hF29dxCPDP26KuTRXI=; h=From:In-Reply-To:Cc:Date:References:To:Subject:Message-ID; b=fW83BvPMVTsAYKsZhq9WKi6wvGLQWwxektSDIs9reQWq+hmkl+kdAe+bGuBbnWtPr +JEp6fvoABPUpEkJ1dq5igKnGm7yy6jF/il1Eb2S+VUdfE2x+QldSyDxTCfsszkbLT s1lhCSX9kHGZIl8VOHXxpdbUEoSel8htGCIKQphc= Authentication-Results: sas1-384d3eaa6677.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: Date: Sun, 7 Aug 2022 14:17:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 2/3] ipsec: compilation fix for GCC-12 Content-Language: en-US To: Amit Prakash Shukla , Bernard Iremonger , Vladimir Medvedkin Cc: dev@dpdk.org, jerinj@marvell.com, stable@dpdk.org References: <20220804134055.1816993-1-amitprakashs@marvell.com> <20220804134055.1816993-2-amitprakashs@marvell.com> From: Konstantin Ananyev In-Reply-To: <20220804134055.1816993-2-amitprakashs@marvell.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 04/08/2022 14:40, Amit Prakash Shukla пишет: > 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 > --- > 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); Acked-by: Konstantin Ananyev